Esempio n. 1
0
 /**
  * Extracts the @package information from the given comment.
  *
  * @param string $comment A doc comment block.
  *
  * @return string
  */
 private function parsePackageAnnotation($comment)
 {
     $package = Builder::DEFAULT_NAMESPACE;
     if (preg_match('#\\*\\s*@package\\s+(\\S+)#', $comment, $match)) {
         $package = trim($match[1]);
         if (preg_match('#\\*\\s*@subpackage\\s+(\\S+)#', $comment, $match)) {
             $package .= '\\' . trim($match[1]);
         }
     }
     // Check for doc level comment
     if ($this->globalPackageName === Builder::DEFAULT_NAMESPACE && $this->isFileComment() === true) {
         $this->globalPackageName = $package;
         $this->compilationUnit->setDocComment($comment);
     }
     return $package;
 }
 /**
  * testGetDocCommentReturnsInjectedDocCommentValue
  *
  * @return void
  */
 public function testGetDocCommentReturnsInjectedDocCommentValue()
 {
     $file = new ASTCompilationUnit(null);
     $file->setDocComment('/** Manuel */');
     $this->assertEquals('/** Manuel */', $file->getDocComment());
 }