\Hazaar\Parser
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.

Tags

Since

2.0.0

Package

Parser

Summary
Methods Properties Constants
tag
No constants
Properties
$brief
$brief
The brief description from the docblock

Tags

Type

string

$comment
$comment
The entire DocBlock comment that was parsed.

Tags

Type

String

$detail
$detail
The long detailed description from the docblock

Tags

Type

string

$tags
$tags
The tags defined in the docblock.

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}.

Tags

Type

Array

Static
$vectors
$vectors
Tags in the docblock that have a whitepace-delimited number of parameters

(such as [email protected] type var desc` and [email protected] type desc`) and the names of those parameters.

Tags

Type

Array

Methods
__construct()
__construct($comment = null)
CONSTRUCTOR.

Parameters

$commentString

The text of the docblock

hasTag()
hasTag($tag) : bool
Whether or not a docblock contains a given @tag.

Parameters

$tagString

The name of the @tag to check for

Returns

\Hazaar\Parser\bool
Static
isTagged()
isTagged($str) : bool
Whether or not a string begins with a @tag

Parameters

$strString

No description

Returns

\Hazaar\Parser\bool
parseComment()
parseComment($comment)
Parse the comment into the component parts and set the state of the object.

Parameters

$commentString

The docblock.

setComment()
setComment($comment)
Set and parse the docblock comment.

Parameters

$commentString

The docblock

setDescription()
setDescription($body)
Parse the description block.

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

$bodyString

The description block.

Static
strTag()
strTag($str) : String|null
The tag at the beginning of a string

Parameters

$strString

No description

Returns

\Hazaar\Parser\String|null
tag()
tag($tag) : Array
The value of a tag

Parameters

$tagString

No description

Returns

Array
tagImplode()
tagImplode($tag, $sep = ' ') : String
The value of a tag (concatenated for multiple values)

Parameters

$tagString

No description

$sepstring

The seperator for concatenating

Returns

String
tagMerge()
tagMerge($tag) : Array
The value of a tag (merged recursively)

Parameters

$tagString

No description

Returns

Array
toArray()
toArray()
trimTextBlock()
trimTextBlock($string)

Parameters

$string

No description