PHP Class phpDocumentor\Reflection\DocBlock

Author: Mike van Riel ([email protected])
Inheritance: implements Reflector
Show file Open project: explodybits/hookr-plugin Class Usage Examples

Protected Properties

Property Type Description
$context Information about the context of this DocBlock.
$location Information about the location of this DocBlock.
$long_description The actual description for this docblock.
$short_description The opening line for this docblock.
$tags An array containing all the tags in this docblock; except inline.

Public Methods

Method Description
__construct ( Reflector | string $docblock, phpDocumentor\Reflection\DocBlock\Context $context = null, phpDocumentor\Reflection\DocBlock\Location $location = null ) Parses the given docblock and populates the member fields.
__toString ( ) : string Returns the exported information (we should use the export static method BUT this throws an exception at this point).
appendTag ( Tag $tag ) : Tag Appends a tag at the end of the list of tags.
export ( ) : string Builds a string representation of this object.
getContext ( ) : phpDocumentor\Reflection\DocBlock\Context Returns the current context.
getLocation ( ) : phpDocumentor\Reflection\DocBlock\Location Returns the current location.
getLongDescription ( ) : Description Returns the full description or also known as long description.
getShortDescription ( ) : string Returns the opening line or also known as short description.
getTags ( ) : Tag[] Returns the tags for this DocBlock.
getTagsByName ( string $name ) : Tag[] Returns an array of tags matching the given name. If no tags are found an empty array is returned.
hasTag ( string $name ) : boolean Checks if a tag of a certain type is present in this DocBlock.

Protected Methods

Method Description
cleanInput ( string $comment ) : string Strips the asterisks from the DocBlock comment.
parseTags ( string $tags ) : void Creates the tag objects.
splitDocBlock ( string $comment ) : string[] Splits the DocBlock into a short description, long description and block of tags.

Method Details

__construct() public method

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.
public __construct ( Reflector | string $docblock, phpDocumentor\Reflection\DocBlock\Context $context = null, phpDocumentor\Reflection\DocBlock\Location $location = null )
$docblock Reflector | string A docblock comment (including asterisks) or reflector supporting the getDocComment method.
$context phpDocumentor\Reflection\DocBlock\Context The context in which the DocBlock occurs.
$location phpDocumentor\Reflection\DocBlock\Location The location within the file that this DocBlock occurs in.

__toString() public method

Returns the exported information (we should use the export static method BUT this throws an exception at this point).
public __toString ( ) : string
return string

appendTag() public method

Appends a tag at the end of the list of tags.
public appendTag ( Tag $tag ) : Tag
$tag phpDocumentor\Reflection\DocBlock\Tag The tag to add.
return phpDocumentor\Reflection\DocBlock\Tag The newly added tag.

cleanInput() protected method

Strips the asterisks from the DocBlock comment.
protected cleanInput ( string $comment ) : string
$comment string String containing the comment text.
return string

export() public static method

Builds a string representation of this object.
public static export ( ) : string
return string

getContext() public method

Returns the current context.
public getContext ( ) : phpDocumentor\Reflection\DocBlock\Context
return phpDocumentor\Reflection\DocBlock\Context

getLocation() public method

Returns the current location.
public getLocation ( ) : phpDocumentor\Reflection\DocBlock\Location
return phpDocumentor\Reflection\DocBlock\Location

getLongDescription() public method

Returns the full description or also known as long description.
public getLongDescription ( ) : Description
return phpDocumentor\Reflection\DocBlock\Description

getShortDescription() public method

Returns the opening line or also known as short description.
public getShortDescription ( ) : string
return string

getTags() public method

Returns the tags for this DocBlock.
public getTags ( ) : Tag[]
return phpDocumentor\Reflection\DocBlock\Tag[]

getTagsByName() public method

Returns an array of tags matching the given name. If no tags are found an empty array is returned.
public getTagsByName ( string $name ) : Tag[]
$name string String to search by.
return phpDocumentor\Reflection\DocBlock\Tag[]

hasTag() public method

Checks if a tag of a certain type is present in this DocBlock.
public hasTag ( string $name ) : boolean
$name string Tag name to check for.
return boolean

parseTags() protected method

Creates the tag objects.
protected parseTags ( string $tags ) : void
$tags string Tag block to parse.
return void

splitDocBlock() protected method

Splits the DocBlock into a short description, long description and block of tags.
Author: RichardJ Special thanks to RichardJ for the regex responsible for the split.
protected splitDocBlock ( string $comment ) : string[]
$comment string Comment to split into the sub-parts.
return string[] containing the short-, long description and an element containing the tags.

Property Details

$context protected property

Information about the context of this DocBlock.
protected $context

$location protected property

Information about the location of this DocBlock.
protected $location

$long_description protected property

The actual description for this docblock.
protected $long_description

$short_description protected property

The opening line for this docblock.
protected $short_description

$tags protected property

An array containing all the tags in this docblock; except inline.
protected $tags