MCPcopy Create free account
hub / github.com/VemtoOrg/vemto2 / enterNode

Method enterNode

src/php/apps/php-merger/classes/CodeReader.php:41–82  ·  view source on GitHub ↗
(Node $node)

Source from the content-addressed store, hash-verified

39 }
40
41 public function enterNode(Node $node)
42 {
43 // Use a stack to keep track of the current parent node
44 // This is needed to set the parent attribute of the nodes
45 if (!empty($this->stack)) {
46 $node->setAttribute('parent', end($this->stack));
47 }
48
49 $this->stack[] = $node;
50
51 // Extract file imports
52 if ($node instanceof Use_) {
53 $this->extractImport($node);
54 }
55
56 // Locate the current class
57 if ($node instanceof Class_) {
58 $this->currentClass = $node;
59
60 $this->extractClass($node);
61 }
62
63 // Extract class use traits
64 if ($node instanceof Node\Stmt\TraitUse) {
65 $this->extractClassUseTrait($node);
66 }
67
68 // Extract class properties
69 if ($node instanceof Property) {
70 $this->extractClassProperty($node);
71 }
72
73 // Extract class methods
74 if ($node instanceof ClassMethod) {
75 $this->extractClassMethod($node);
76 }
77
78 // Extract removed methods from comments like "// removed_method:method_name"
79 if ($node instanceof Node\Stmt\Nop) {
80 $this->extractRemovedMethod($node);
81 }
82 }
83
84 public function extractImport($node)
85 {

Callers

nothing calls this directly

Calls 6

extractImportMethod · 0.95
extractClassMethod · 0.95
extractClassUseTraitMethod · 0.95
extractClassPropertyMethod · 0.95
extractClassMethodMethod · 0.95
extractRemovedMethodMethod · 0.95

Tested by

no test coverage detected