DocBlock
DocBlock
The docblock parser class.
This class can be used to parse text comments in docblock format into an array of tags and their values.
Properties
vectors
Tags in the docblock that have a whitepace-delimited number of parameters
private array $vectors
(such as @param type var desc
and @return type desc
) and the names of those parameters.
brief
public string $brief
detail
public string $detail
tags
The tags defined in the docblock.
private array $tags
The array has keys which are the tag names (excluding the @) and values that are arrays, each of which is an entry for the tag.
In the case where the tag name is defined in {@see DocBlock::$vectors} the value within the tag-value array is an array in itself with keys as described by {@see DocBlock::$vectors}.
Methods
__construct
CONSTRUCTOR.
public __construct({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$comment | NULL | The text of the docblock |
setComment
Set and parse the docblock comment.
public setComment({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$comment | string | The docblock |
hasTag
Whether or not a docblock contains a given @tag.
public hasTag({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$tag | string | The name of the @tag to check for |
tag
The value of a tag.
public tag({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$tag | string |
tagImplode
The value of a tag (concatenated for multiple values).
public tagImplode({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$tag | string | |
$sep | string | The seperator for concatenating |
tagMerge
The value of a tag (merged recursively).
public tagMerge({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$tag | string |
toArray
Return the parsed DocBlock as a nice friendly array.
public toArray({Array})
brief
Return the brief comment if set.
public brief({Array})
detail
Return the detailed comment if set.
public detail({Array})
parseComment
Parse the comment into the component parts and set the state of the object.
protected parseComment({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$comment | string | the docblock |
setDescription
Parse the description block.
protected setDescription({Array})
This block can be either a single line, which will be used as the brief description. Anything after the first line is used as the detailed description.
Parameters
Parameter | Type | Description |
---|---|---|
$body | string | the description block |
trimTextBlock
private trimTextBlock({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$string | string |
isTagged
private isTagged({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$str | string |
strTag
private strTag({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$str | string |
Generated by Hazaar API Doc Generator