Пример #1
0
 /**
  * Parses the signature of a class.
  *
  * The signature of a class consists of optional class modifiers like, final
  * or abstract, the T_CLASS token, the class name, an optional parent class
  * and an optional list of implemented interfaces.
  *
  * @return \PDepend\Source\AST\ASTClass
  * @since  1.0.0
  */
 private function parseClassSignature()
 {
     $this->parseClassModifiers();
     $this->consumeToken(Tokens::T_CLASS);
     $this->consumeComments();
     $qualifiedName = $this->createQualifiedTypeName($this->parseClassName());
     $class = $this->builder->buildClass($qualifiedName);
     $class->setCompilationUnit($this->compilationUnit);
     $class->setModifiers($this->modifiers);
     $class->setDocComment($this->docComment);
     $class->setId($this->idBuilder->forClassOrInterface($class));
     $class->setUserDefined();
     $this->consumeComments();
     $tokenType = $this->tokenizer->peek();
     if ($tokenType === Tokens::T_EXTENDS) {
         $class = $this->parseClassExtends($class);
         $this->consumeComments();
         $tokenType = $this->tokenizer->peek();
     }
     if ($tokenType === Tokens::T_IMPLEMENTS) {
         $this->consumeToken(Tokens::T_IMPLEMENTS);
         $this->parseInterfaceList($class);
     }
     return $class;
 }
 /**
  * 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));
 }