/** * @param \PhpParser\Node $node */ public function enterNode(\PhpParser\Node $node) { if ($node instanceof \PhpParser\Node\Stmt\Namespace_) { $this->namespace = join('\\', $node->name->parts); $this->aliasMap['::context'] = $this->namespace; } else if ($node instanceof \PhpParser\Node\Stmt\UseUse) { $this->aliasMap[$node->alias] = join('\\', $node->name->parts); } else if ($node instanceof \PhpParser\Node\Stmt\Class_) { $this->unit = $this->result->addClass((string)$node->namespacedName); $this->processUnit($node); return; } else if ($node instanceof \PhpParser\Node\Stmt\Interface_) { $this->unit = $this->result->addInterface((string)$node->namespacedName); $this->processUnit($node); return; } else if ($node instanceof \PhpParser\Node\Stmt\Trait_) { $this->unit = $this->result->addTrait((string)$node->namespacedName); $this->processUnit($node); return; } else if ($node instanceof \PhpParser\Node\Stmt\Property) { $this->processProperty($node); return; } else if ($node instanceof \PhpParser\Node\Stmt\ClassMethod) { $this->processMethod($node); return; } elseif ($node instanceof \PhpParser\Node\Stmt\ClassConst) { $this->processClassConstant($node); } elseif ($node instanceof \PhpParser\Comment) { // } }
/** * @param \PhpParser\Node $node */ public function enterNode(\PhpParser\Node $node) { if ($node instanceof NodeType\Namespace_ && $node->name != NULL) { $this->namespace = join('\\', $node->name->parts); $this->aliasMap['::context'] = $this->namespace; } else { if ($node instanceof NodeType\UseUse) { $this->aliasMap[$node->alias] = join('\\', $node->name->parts); } else { if ($node instanceof NodeType\Class_) { $this->aliasMap['::unit'] = (string) $node->namespacedName; $this->unit = $this->result->addClass((string) $node->namespacedName); $this->processUnit($node); return; } else { if ($node instanceof NodeType\Interface_) { $this->aliasMap['::unit'] = (string) $node->namespacedName; $this->unit = $this->result->addInterface((string) $node->namespacedName); $this->processUnit($node); return; } else { if ($node instanceof NodeType\Trait_) { $this->aliasMap['::unit'] = (string) $node->namespacedName; $this->unit = $this->result->addTrait((string) $node->namespacedName); $this->processUnit($node); return; } else { if ($node instanceof NodeType\Property) { $this->processProperty($node); return; } else { if ($node instanceof NodeType\ClassMethod) { $this->processMethod($node); return; } elseif ($node instanceof NodeType\ClassConst) { $this->processClassConstant($node); } elseif ($node instanceof NodeType\TraitUse) { $this->processTraitUse($node); } } } } } } } }
/** * @param \PHPParser_Node $node */ public function enterNode(\PHPParser_Node $node) { if ($node instanceof \PHPParser_Node_Stmt_Namespace) { $this->namespace = join('\\', $node->name->parts); $this->aliasMap['::context'] = $this->namespace; } else { if ($node instanceof \PHPParser_Node_Stmt_UseUse) { $this->aliasMap[$node->alias] = join('\\', $node->name->parts); } else { if ($node instanceof \PHPParser_Node_Stmt_Class) { $this->unit = $this->result->addClass((string) $node->namespacedName); $this->processUnit($node); return; } else { if ($node instanceof \PHPParser_Node_Stmt_Interface) { $this->unit = $this->result->addInterface((string) $node->namespacedName); $this->processUnit($node); return; } else { if ($node instanceof \PHPParser_Node_Stmt_Trait) { $this->unit = $this->result->addTrait((string) $node->namespacedName); $this->processUnit($node); return; } else { if ($node instanceof \PHPParser_Node_Stmt_Property) { $this->processProperty($node); return; } else { if ($node instanceof \PHPParser_Node_Stmt_ClassMethod) { $this->processMethod($node); return; } elseif ($node instanceof \PHPParser_Node_Stmt_ClassConst) { $this->processClassConstant($node); } elseif ($node instanceof \PHPParser_Comment) { // } } } } } } } }