コード例 #1
0
 /**
  * Visits a code interface object.
  *
  * @param \PDepend\Source\AST\ASTInterface $interface
  * @return void
  */
 public function visitInterface(ASTInterface $interface)
 {
     if (false === $interface->isUserDefined()) {
         return;
     }
     $this->fireStartInterface($interface);
     // Update global class count
     ++$this->noi;
     $id = $interface->getNamespace()->getId();
     ++$this->nodeMetrics[$id][self::M_NUMBER_OF_INTERFACES];
     $this->nodeMetrics[$interface->getId()] = array(self::M_NUMBER_OF_METHODS => 0);
     foreach ($interface->getMethods() as $method) {
         $method->accept($this);
     }
     $this->fireEndInterface($interface);
 }
コード例 #2
0
 /**
  * Visits a code interface object.
  *
  * @param \PDepend\Source\AST\ASTInterface $interface
  * @return void
  */
 public function visitInterface(ASTInterface $interface)
 {
     if (!$interface->isUserDefined()) {
         return;
     }
     $doc = $this->abstractClasses->ownerDocument;
     $classXml = $doc->createElement('Class');
     $classXml->setAttribute('sourceFile', (string) $interface->getCompilationUnit());
     $classXml->appendChild($doc->createTextNode($interface->getName()));
     $this->abstractClasses->appendChild($classXml);
 }
コード例 #3
0
ファイル: PHPBuilder.php プロジェクト: digitronac/pdepend
 /**
  * This method will persist an interface instance for later reuse.
  *
  * @param  string                           $interfaceName
  * @param  string                           $namespaceName
  * @param  \PDepend\Source\AST\ASTInterface $interface
  * @return void
  * @@since 0.9.5
  */
 protected function storeInterface($interfaceName, $namespaceName, ASTInterface $interface)
 {
     $interfaceName = strtolower($interfaceName);
     if (!isset($this->interfaces[$interfaceName][$namespaceName])) {
         $this->interfaces[$interfaceName][$namespaceName] = array();
     }
     $this->interfaces[$interfaceName][$namespaceName][$interface->getId()] = $interface;
     $namespace = $this->buildNamespace($namespaceName);
     $namespace->addType($interface);
 }
コード例 #4
0
 /**
  * Creates an abstract item instance.
  *
  * @return \PDepend\Source\AST\ASTInterface
  */
 protected function createItem()
 {
     $interface = new ASTInterface(__CLASS__);
     $interface->setCompilationUnit(new ASTCompilationUnit(__FILE__));
     $interface->setCache(new MemoryCacheDriver());
     $interface->setContext($this->getMock('PDepend\\Source\\Builder\\BuilderContext'));
     return $interface;
 }
 /**
  * Visits a code interface object.
  *
  * @param \PDepend\Source\AST\ASTInterface $interface
  * @return void
  */
 public function visitInterface(ASTInterface $interface)
 {
     $this->visits[] = $interface->getName();
     parent::visitInterface($interface);
 }
コード例 #6
0
ファイル: Parser.php プロジェクト: flavius/phpmd
 /**
  * Visits an interface node.
  *
  * @param \PDepend\Source\AST\ASTInterface $node
  * @return void
  */
 public function visitInterface(ASTInterface $node)
 {
     if (!$node->isUserDefined()) {
         return;
     }
     $this->apply(new InterfaceNode($node));
     parent::visitInterface($node);
 }
コード例 #7
0
 /**
  * testBuilderCreatesCaseInSensitiveInterfaceIdentifiers
  *
  * @return void
  */
 public function testBuilderCreatesCaseInSensitiveInterfaceIdentifiers()
 {
     $compilationUnit = new ASTCompilationUnit(__FILE__);
     $compilationUnit->setId(__FUNCTION__);
     $interface0 = new ASTInterface(__FUNCTION__);
     $interface0->setCompilationUnit($compilationUnit);
     $interface1 = new ASTInterface(strtolower(__FUNCTION__));
     $interface1->setCompilationUnit($compilationUnit);
     $builder0 = new IdBuilder();
     $builder1 = new IdBuilder();
     $this->assertEquals($builder0->forClassOrInterface($interface0), $builder1->forClassOrInterface($interface1));
 }
コード例 #8
0
 /**
  * Creates a ready to use interface fixture.
  *
  * @param string $name Optional interface name.
  *
  * @return \PDepend\Source\AST\ASTInterface
  * @since 1.0.2
  */
 protected function createInterfaceFixture($name = null)
 {
     $name = $name ? $name : get_class($this);
     $interface = new ASTInterface($name);
     $interface->setCompilationUnit(new ASTCompilationUnit($GLOBALS['argv'][0]));
     $interface->setCache(new MemoryCacheDriver());
     return $interface;
 }