DocblockTag
class DocblockTag (View source)
Hold the tag definition for one tag in a DocBlock.
The tag can be sliced into the following forms:
- "@tag content"
- "@tag word description"
- "@tag $variable description"
- "@tag word $variable description"
Constants
TAG_REGEX |
|
VARIABLE_REGEX |
|
VARIABLE_OR_WORD_REGEX |
|
TYPE_REGEX |
|
WORD_REGEX |
|
DESCRIPTION_REGEX |
|
IS_TAG_REGEX |
|
Properties
protected string | $tag | ||
protected string|null | $content |
Methods
Check if the provided string begins with a tag
Use a regular expression to separate the tag from the content.
DockblockTag constructor
Add more content onto a tag during parsing.
Return the tag - e.g. "@foo description" returns 'foo'
Return the content portion of the tag - e.g. "@foo bar baz boz" returns "bar baz boz"
Convert tag back into a string.
Determine if tag is one of:
- "@tag variable description"
- "@tag $variable description"
- "@tag type $variable description"
Determine if tag is "@tag $variable description"
Determine if tag is "@tag type $variable description"
Determine if tag is "@tag word description"
Details
static bool
isTag(string $subject)
Check if the provided string begins with a tag
static bool
splitTagAndContent(string $subject, string[] $matches)
Use a regular expression to separate the tag from the content.
__construct($tag, $content = null)
DockblockTag constructor
appendContent($line)
Add more content onto a tag during parsing.
string
getTag()
Return the tag - e.g. "@foo description" returns 'foo'
string
getContent()
Return the content portion of the tag - e.g. "@foo bar baz boz" returns "bar baz boz"
__toString()
Convert tag back into a string.
bool
hasVariable(string[] $matches)
Determine if tag is one of:
- "@tag variable description"
- "@tag $variable description"
- "@tag type $variable description"
bool
hasVariableAndDescription(string[] $matches)
Determine if tag is "@tag $variable description"
bool
hasTypeVariableAndDescription(string[] $matches)
Determine if tag is "@tag type $variable description"
bool
hasWordAndDescription(string[] $matches)
Determine if tag is "@tag word description"