/** * Generic visit method for classes and interfaces. Both visit methods * delegate calls to this method. * * @param \PDepend\Source\AST\AbstractASTClassOrInterface $type * @return void */ protected function visitType(AbstractASTClassOrInterface $type) { $id = $type->getNamespace()->getId(); // Increment total classes count ++$this->nodeMetrics[$id][self::M_NUMBER_OF_CLASSES]; // Check for abstract or concrete class if ($type->isAbstract()) { ++$this->nodeMetrics[$id][self::M_NUMBER_OF_ABSTRACT_CLASSES]; } else { ++$this->nodeMetrics[$id][self::M_NUMBER_OF_CONCRETE_CLASSES]; } foreach ($type->getDependencies() as $dependency) { $this->collectDependencies($type->getNamespace(), $dependency->getNamespace()); } foreach ($type->getMethods() as $method) { $method->accept($this); } }
/** * Generic visitor method for classes and interfaces. Both visit methods * delegate calls to this method. * * @param \PDepend\Source\AST\AbstractASTClassOrInterface $type * @return void */ protected function visitType(AbstractASTClassOrInterface $type) { $namespace = $type->getNamespace(); $this->initNode($namespace); $this->initNode($type); foreach ($type->getDependencies() as $dependency) { $depPkg = $dependency->getNamespace(); $this->initNode($dependency); $this->initNode($depPkg); $this->nodes[$type->getId()]['in'][] = $dependency->getId(); $this->nodes[$dependency->getId()]['out'][] = $type->getId(); // No self references if ($namespace !== $depPkg) { $this->nodes[$namespace->getId()]['in'][] = $depPkg->getId(); $this->nodes[$depPkg->getId()]['out'][] = $namespace->getId(); } } }