コード例 #1
0
ファイル: Return.php プロジェクト: lortnus/zf1
 public static function fromReflection(ZendL_Reflection_Docblock_Tag $reflectionTagReturn)
 {
     $returnTag = new self();
     $returnTag->setName('return');
     $returnTag->setDatatype($reflectionTagReturn->getType());
     // @todo rename
     $returnTag->setDescription($reflectionTagReturn->getDescription());
     return $returnTag;
 }
コード例 #2
0
ファイル: Param.php プロジェクト: lortnus/zf1
 public static function fromReflection(ZendL_Reflection_Docblock_Tag $reflectionTagParam)
 {
     $paramTag = new self();
     $paramTag->setName('param');
     $paramTag->setDatatype($reflectionTagParam->getType());
     // @todo rename
     $paramTag->setParamName($reflectionTagParam->getVariableName());
     $paramTag->setDescription($reflectionTagParam->getDescription());
     return $paramTag;
 }
コード例 #3
0
ファイル: Tag.php プロジェクト: lortnus/zf1
 public static function fromReflection(ZendL_Reflection_Docblock_Tag $reflectionTag)
 {
     $tagName = $reflectionTag->getName();
     if (array_key_exists($tagName, self::$_tagClasses)) {
         $tagClass = self::$_tagClasses[$tagName];
         if (!class_exists($tagClass)) {
             Zend_Loader::loadClass($tagClass);
         }
         $tag = call_user_func(array($tagClass, 'fromReflection'), $reflectionTag);
     } else {
         $tag = new self();
         $tag->setName($reflectionTag->getName());
         $tag->setDescription($reflectionTag->getDescription());
     }
     return $tag;
 }
コード例 #4
0
ファイル: Docblock.php プロジェクト: lortnus/zf1
 protected function _parse()
 {
     $docComment = $this->_docComment;
     // First remove doc block line starters
     $docComment = preg_replace('#[ \\t]*(?:\\/\\*\\*|\\*\\/|\\*)?[ ]{0,1}(.*)?#', '$1', $docComment);
     $docComment = ltrim($docComment, "\r\n");
     // @todo should be changed to remove first and last empty line
     $this->_cleanDocComment = $docComment;
     // Next parse out the tags and descriptions
     $parsedDocComment = $docComment;
     $lineNumber = $firstBlandLineEncountered = 0;
     while (($newlinePos = strpos($parsedDocComment, "\n")) !== false) {
         $lineNumber++;
         $line = substr($parsedDocComment, 0, $newlinePos);
         if (strpos($line, '@') === 0 && preg_match('#^(@\\w+.*?)(\\n)(?:@|\\r?\\n|$)#s', $parsedDocComment, $matches)) {
             $this->_tags[] = ZendL_Reflection_Docblock_Tag::factory($matches[1]);
             $parsedDocComment = str_replace($matches[1] . $matches[2], '', $parsedDocComment);
         } else {
             if ($lineNumber < 3 && !$firstBlandLineEncountered) {
                 $this->_shortDescription .= $line . "\n";
             } else {
                 $this->_longDescription .= $line . "\n";
             }
             if ($line == '') {
                 $firstBlandLineEncountered = true;
             }
             $parsedDocComment = substr($parsedDocComment, $newlinePos + 1);
         }
     }
     $this->_shortDescription = rtrim($this->_shortDescription);
     $this->_longDescription = rtrim($this->_longDescription);
 }