예제 #1
0
파일: Parser.php 프로젝트: rouffj/pdepend
 /**
  * This method parses a function declaration.
  *
  * @return PHP_Depend_Code_Function
  * @since 0.9.5
  */
 private function _parseFunctionDeclaration()
 {
     $this->consumeComments();
     // Next token must be the function identifier
     $functionName = $this->parseFunctionName();
     $function = $this->builder->buildFunction($functionName);
     $function->setSourceFile($this->_sourceFile);
     $function->setUUID($this->_uuidBuilder->forFunction($function));
     $this->_parseCallableDeclaration($function);
     // First check for an existing namespace
     if ($this->_namespaceName !== null) {
         $packageName = $this->_namespaceName;
     } else {
         if ($this->_packageName !== self::DEFAULT_PACKAGE) {
             $packageName = $this->_packageName;
         } else {
             $packageName = $this->_globalPackageName;
         }
     }
     $this->builder->buildPackage($packageName)->addFunction($function);
     // Store function in source file, because we need them during the file's
     // __wakeup() phase for function declarations within another function or
     // method declaration.
     $this->_sourceFile->addChild($function);
     return $function;
 }
예제 #2
0
 /**
  * This method parses a function declaration.
  *
  * @return PHP_Depend_Code_Function
  * @since 0.9.5
  */
 private function _parseFunctionDeclaration()
 {
     $this->_consumeComments();
     // Next token must be the function identifier
     $functionName = $this->getFunctionNameParser()->parse($this->_tokenizer);
     $function = $this->_builder->buildFunction($functionName);
     $this->_parseCallableDeclaration($function);
     // First check for an existing namespace
     if ($this->_namespaceName !== null) {
         $packageName = $this->_namespaceName;
     } else {
         if ($this->_packageName !== self::DEFAULT_PACKAGE) {
             $packageName = $this->_packageName;
         } else {
             $packageName = $this->_globalPackageName;
         }
     }
     $this->_builder->buildPackage($packageName)->addFunction($function);
     return $function;
 }