Neos\Flow\Reflection\DocCommentParser::parseDocComment PHP 메소드

parseDocComment() 공개 메소드

Parses the given doc comment and saves the result (description and tags) in the parser's object. They can be retrieved by the getTags() getTagValues() and getDescription() methods.
public parseDocComment ( string $docComment ) : void
$docComment string A doc comment as returned by the reflection getDocComment() method
리턴 void
    public function parseDocComment($docComment)
    {
        $this->description = '';
        $this->tags = [];
        $lines = explode(chr(10), $docComment);
        foreach ($lines as $line) {
            $line = trim($line);
            if ($line === '*/') {
                break;
            }
            if ($line !== '' && strpos($line, '* @') !== false) {
                $this->parseTag(substr($line, strpos($line, '@')));
            } elseif (count($this->tags) === 0) {
                $this->description .= preg_replace('/\\s*\\/?[\\\\*]*\\s?(.*)$/', '$1', $line) . chr(10);
            }
        }
        $this->description = trim($this->description);
    }

Usage Example

예제 #1
0
 /**
  * Returns the description of a migration.
  *
  * If available it is fetched from the getDescription() method, if that returns an empty value
  * the class docblock is used instead.
  *
  * @param Version $version
  * @param DocCommentParser $parser
  * @return string
  */
 protected function getMigrationDescription(Version $version, DocCommentParser $parser)
 {
     if ($version->getMigration()->getDescription()) {
         return $version->getMigration()->getDescription();
     } else {
         $reflectedClass = new \ReflectionClass($version->getMigration());
         $parser->parseDocComment($reflectedClass->getDocComment());
         return str_replace([chr(10), chr(13)], ' ', $parser->getDescription());
     }
 }
All Usage Examples Of Neos\Flow\Reflection\DocCommentParser::parseDocComment