Пример #1
0
 /**
  * Generic visit method for classes and interfaces. Both visit methods
  * delegate calls to this method.
  *
  * @param PHP_Depend_Code_AbstractClassOrInterface $type The type instance.
  *
  * @return void
  */
 protected function visitType(PHP_Depend_Code_AbstractClassOrInterface $type)
 {
     // Get context package uuid
     $pkgUUID = $type->getPackage()->getUuid();
     // Increment total classes count
     ++$this->nodeMetrics[$pkgUUID][self::M_NUMBER_OF_CLASSES];
     // Check for abstract or concrete class
     if ($type->isAbstract()) {
         ++$this->nodeMetrics[$pkgUUID][self::M_NUMBER_OF_ABSTRACT_CLASSES];
     } else {
         ++$this->nodeMetrics[$pkgUUID][self::M_NUMBER_OF_CONCRETE_CLASSES];
     }
     foreach ($type->getDependencies() as $dep) {
         $this->collectDependencies($type->getPackage(), $dep->getPackage());
     }
     foreach ($type->getMethods() as $method) {
         $method->accept($this);
     }
 }
Пример #2
0
 /**
  * Generic visitor method for classes and interfaces. Both visit methods
  * delegate calls to this method.
  *
  * @param PHP_Depend_Code_AbstractClassOrInterface $type The context type
  *        instance.
  *
  * @return void
  */
 protected function visitType(PHP_Depend_Code_AbstractClassOrInterface $type)
 {
     $pkg = $type->getPackage();
     $this->initNode($pkg);
     $this->initNode($type);
     foreach ($type->getDependencies() as $dep) {
         $depPkg = $dep->getPackage();
         $this->initNode($dep);
         $this->initNode($depPkg);
         $this->nodes[$type->getUuid()]['in'][] = $dep->getUuid();
         $this->nodes[$dep->getUuid()]['out'][] = $type->getUuid();
         // No self references
         if ($pkg !== $depPkg) {
             $this->nodes[$pkg->getUuid()]['in'][] = $depPkg->getUuid();
             $this->nodes[$depPkg->getUuid()]['out'][] = $pkg->getUuid();
         }
     }
 }
 /**
  * Constructs a new exception instance.
  *
  * @param PHP_Depend_Code_AbstractClassOrInterface $type The class or
  *        interface that is part of the endless inheritance hierarchy.
  */
 public function __construct(PHP_Depend_Code_AbstractClassOrInterface $type)
 {
     parent::__construct(sprintf('Type %s\\%s is part of an endless inheritance hierarchy.', preg_replace('(\\W+)', '\\', $type->getPackage()->getName()), $type->getName()));
 }