Example #1
0
 /**
  * Parses the signature of an interface and finally returns a configured
  * interface instance.
  *
  * @return PHP_Depend_Code_Interface
  * @since 0.10.2
  */
 private function _parseInterfaceSignature()
 {
     $this->consumeToken(self::T_INTERFACE);
     $this->consumeComments();
     $qualifiedName = $this->_createQualifiedTypeName($this->parseClassName());
     $interface = $this->builder->buildInterface($qualifiedName);
     $interface->setSourceFile($this->_sourceFile);
     $interface->setDocComment($this->_docComment);
     $interface->setUUID($this->_uuidBuilder->forClassOrInterface($interface));
     $interface->setUserDefined();
     return $this->_parseOptionalExtendsList($interface);
 }
Example #2
0
 /**
  * Parses the dependencies in a interface signature.
  *
  * @return PHP_Depend_Code_Interface
  */
 private function _parseInterfaceDeclaration()
 {
     $this->_tokenStack->push();
     // Consume interface keyword
     $startLine = $this->_consumeToken(self::T_INTERFACE)->startLine;
     // Remove leading comments and get interface name
     $this->_consumeComments();
     $localName = $this->_consumeToken(self::T_STRING)->image;
     $qualifiedName = $this->_createQualifiedTypeName($localName);
     $interface = $this->_builder->buildInterface($qualifiedName);
     $interface->setSourceFile($this->_sourceFile);
     $interface->setDocComment($this->_docComment);
     $interface->setUUID($this->_uuidBuilder->forClassOrInterface($interface));
     $interface->setUserDefined();
     // Strip comments and fetch next token type
     $this->_consumeComments();
     $tokenType = $this->_tokenizer->peek();
     // Check for extended interfaces
     if ($tokenType === self::T_EXTENDS) {
         $this->_consumeToken(self::T_EXTENDS);
         $this->_parseInterfaceList($interface);
     }
     // Handle interface body
     $this->_parseClassOrInterfaceBody($interface);
     $interface->setTokens($this->_tokenStack->pop());
     // Reset parser settings
     $this->reset();
     return $interface;
 }