Documentation

DocBlock
in package

Table of Contents

$context  : Context|null
$description  : Description
$isTemplateEnd  : bool
$isTemplateStart  : bool
$location  : Location|null
$summary  : string
$tags  : array<string|int, Tag>
__construct()  : mixed
getContext()  : Context|null
Returns the current context.
getDescription()  : Description
getLocation()  : Location|null
Returns the current location.
getSummary()  : string
getTags()  : array<string|int, Tag>
Returns the tags for this DocBlock.
getTagsByName()  : array<string|int, Tag>
Returns an array of tags matching the given name. If no tags are found an empty array is returned.
getTagsWithTypeByName()  : array<string|int, TagWithType>
Returns an array of tags with type matching the given name. If no tags are found an empty array is returned.
hasTag()  : bool
Checks if a tag of a certain type is present in this DocBlock.
isTemplateEnd()  : bool
Returns whether this DocBlock is the end of a Template section.
isTemplateStart()  : bool
Returns whether this DocBlock is the start of a Template section.
removeTag()  : void
Remove a tag from this DocBlock.
addTag()  : void
Adds a tag to this DocBlock.

Properties

$context

private Context|null $context

Information about the context of this DocBlock.

$isTemplateEnd

private bool $isTemplateEnd

Does this DocBlock signify the end of a DocBlock template?

$isTemplateStart

private bool $isTemplateStart

Is this DocBlock (the start of) a template?

$location

private Location|null $location

Information about the location of this DocBlock.

$summary

private string $summary

The opening line for this docblock.

$tags

private array<string|int, Tag> $tags = []

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

Methods

__construct()

public __construct([string $summary = '' ][, Description|null $description = null ][, array<string|int, Tag$tags = [] ][, Context $context = null ][, Location $location = null ][, bool $isTemplateStart = false ][, bool $isTemplateEnd = false ]) : mixed
Parameters
$summary : string = ''
$description : Description|null = null
$tags : array<string|int, Tag> = []
$context : Context = null

The context in which the DocBlock occurs.

$location : Location = null

The location within the file that this DocBlock occurs in.

$isTemplateStart : bool = false
$isTemplateEnd : bool = false
Return values
mixed

getSummary()

public getSummary() : string
Return values
string

getTags()

Returns the tags for this DocBlock.

public getTags() : array<string|int, Tag>
Return values
array<string|int, Tag>

getTagsByName()

Returns an array of tags matching the given name. If no tags are found an empty array is returned.

public getTagsByName(string $name) : array<string|int, Tag>
Parameters
$name : string

String to search by.

Return values
array<string|int, Tag>

getTagsWithTypeByName()

Returns an array of tags with type matching the given name. If no tags are found an empty array is returned.

public getTagsWithTypeByName(string $name) : array<string|int, TagWithType>
Parameters
$name : string

String to search by.

Return values
array<string|int, TagWithType>

hasTag()

Checks if a tag of a certain type is present in this DocBlock.

public hasTag(string $name) : bool
Parameters
$name : string

Tag name to check for.

Return values
bool

isTemplateEnd()

Returns whether this DocBlock is the end of a Template section.

public isTemplateEnd() : bool
Tags
see
self::isTemplateStart()

for a more complete description of the Docblock Template functionality.

Return values
bool

isTemplateStart()

Returns whether this DocBlock is the start of a Template section.

public isTemplateStart() : bool

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 (#@-).

Tags
see
self::isTemplateEnd()

for the check whether a closing marker was provided.

Return values
bool

removeTag()

Remove a tag from this DocBlock.

public removeTag(Tag $tagToRemove) : void
Parameters
$tagToRemove : Tag

The tag to remove.

Return values
void

addTag()

Adds a tag to this DocBlock.

private addTag(Tag $tag) : void
Parameters
$tag : Tag

The tag to add.

Return values
void

Search results