You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then we can use the create method of the factory to interpret the DocBlock.
Please note that it is also possible to provide a class that has the
getDocComment() method, such as an object of type ReflectionClass, the
create method will read that if it exists.
$docComment = <<<DOCCOMMENT/** * This is an example of a summary. * * This is a Description. A Summary and Description are separated by either * two subsequent newlines (thus a whiteline in between as can be seen in this * example), or when the Summary ends with a dot (`.`) and some form of * whitespace. */DOCCOMMENT;
$docblock = $factory->create($docComment);
The create method will yield an object of type \phpDocumentor\Reflection\DocBlock
whose methods can be queried:
// Contains the summary for this DocBlock$summary = $docblock->getSummary();
// Contains \phpDocumentor\Reflection\DocBlock\Description object$description = $docblock->getDescription();
// You can either cast it to string$description = (string) $docblock->getDescription();
// Or use the render method to get a string representation of the Description.$description = $docblock->getDescription()->render();
For more examples it would be best to review the scripts in the /examples folder.