DocBlock
class DocBlock implements Reflector
Class DocBlock - Parses the DocBlock for any structure.
Properties
| protected string | $shortDescription | ||
| protected Description | $longDescription | ||
| protected Tag[] | $tags | ||
| protected Context | $context | ||
| protected Location | $location | ||
| protected bool | $isTemplateStart | ||
| protected bool | $isTemplateEnd |
Methods
Parses the given docblock and populates the member fields.
Gets the text portion of the doc block.
Returns the opening line or also known as short description.
Returns the full description or also known as long description.
Returns whether this DocBlock is the start of a Template section.
Returns whether this DocBlock is the end of a Template section.
Returns the current context.
Returns the current location.
Returns an array of tags matching the given name. If no tags are found an empty array is returned.
Checks if a tag of a certain type is present in this DocBlock.
Builds a string representation of this object.
Returns the exported information (we should use the export static method BUT this throws an exception at this point).
Strips the asterisks from the DocBlock comment.
Splits the DocBlock into a template marker, summary, description and block of tags.
Creates the tag objects.
Details
at line 61
__construct(Reflector|string $docblock, Context $context = null, Location $location = null, bool $parseTags = false)
Parses the given docblock and populates the member fields.
The constructor may also receive namespace information such as the current namespace and aliases. This information is used by some tags (e.g. @return, @param, etc.) to turn a relative Type into a FQCN.
at line 90
string
getText()
Gets the text portion of the doc block.
Gets the text portion (short and long description combined) of the doc block.
at line 111
DocBlock
setText(string $comment)
Set the text portion of the doc block.
Sets the text portion (short and long description combined) of the doc block.
at line 125
string
getShortDescription()
Returns the opening line or also known as short description.
at line 135
Description
getLongDescription()
Returns the full description or also known as long description.
at line 161
boolean
isTemplateStart()
Returns whether this DocBlock is the start of a Template section.
A Docblock may serve as template for a series of subsequent DocBlocks. This is indicated by a special marker
(#@+) that is appended directly after the opening /** of a DocBlock.
An example of such an opening is:
/**#@+
* My DocBlock
* /
The description and tags (not the summary!) are copied onto all subsequent DocBlocks and also applied to all
elements that follow until another DocBlock is found that contains the closing marker (#@-).
at line 173
boolean
isTemplateEnd()
Returns whether this DocBlock is the end of a Template section.
at line 183
Context
getContext()
Returns the current context.
at line 193
Location
getLocation()
Returns the current location.
at line 203
Tag[]
getTags()
Returns the tags for this DocBlock.
at line 216
Tag[]
getTagsByName(string $name)
Returns an array of tags matching the given name. If no tags are found an empty array is returned.
at line 237
bool
hasTag(string $name)
Checks if a tag of a certain type is present in this DocBlock.
at line 285
static string
export()
Builds a string representation of this object.
at line 298
string
__toString()
Returns the exported information (we should use the export static method BUT this throws an exception at this point).
at line 310
protected string
cleanInput(string $comment)
Strips the asterisks from the DocBlock comment.
at line 339
protected string[]
splitDocBlock(string $comment)
Splits the DocBlock into a template marker, summary, description and block of tags.
at line 413
protected void
parseTags(string $tags)
Creates the tag objects.