Documentation

DocBlock
in package

This class represents a docblock.

It internally splits it up into "lines" that we can manipulate.

Tags
author

Graham Campbell graham@alt-three.com

final

Table of Contents

$annotations  : null|array<string|int, Annotation>
The array of annotations.
$lines  : array<string|int, Line>
The array of lines.
$namespace  : null|NamespaceAnalysis
$namespaceUses  : array<string|int, NamespaceUseAnalysis>
__construct()  : mixed
Create a new docblock instance.
__toString()  : string
Get the string representation of object.
getAnnotation()  : null|Annotation
getAnnotations()  : array<string|int, Annotation>
Get this docblock's annotations.
getAnnotationsOfType()  : array<string|int, Annotation>
Get specific types of annotations only.
getContent()  : string
Get the actual content of this docblock.
getLine()  : null|Line
Get a single line.
getLines()  : array<string|int, Line>
Get this docblock's lines.
isMultiLine()  : mixed
makeMultiLine()  : mixed
Take a one line doc block, and turn it into a multi line doc block.
makeSingleLine()  : mixed
findAnnotationLength()  : mixed
getSingleLineDocBlockEntry()  : string

Properties

$annotations

The array of annotations.

private null|array<string|int, Annotation> $annotations

$lines

The array of lines.

private array<string|int, Line> $lines = []

$namespace

private null|NamespaceAnalysis $namespace

$namespaceUses

private array<string|int, NamespaceUseAnalysis> $namespaceUses

Methods

__construct()

Create a new docblock instance.

public __construct(string $content[, null|NamespaceAnalysis $namespace = null ][, array<string|int, NamespaceUseAnalysis$namespaceUses = [] ]) : mixed
Parameters
$content : string
$namespace : null|NamespaceAnalysis = null
$namespaceUses : array<string|int, NamespaceUseAnalysis> = []
Return values
mixed

__toString()

Get the string representation of object.

public __toString() : string
Return values
string

getAnnotations()

Get this docblock's annotations.

public getAnnotations() : array<string|int, Annotation>
Return values
array<string|int, Annotation>

getAnnotationsOfType()

Get specific types of annotations only.

public getAnnotationsOfType(string|array<string|int, string> $types) : array<string|int, Annotation>

If none exist, we're returning an empty array.

Parameters
$types : string|array<string|int, string>
Return values
array<string|int, Annotation>

getContent()

Get the actual content of this docblock.

public getContent() : string
Return values
string

getLine()

Get a single line.

public getLine(int $pos) : null|Line
Parameters
$pos : int
Return values
null|Line

getLines()

Get this docblock's lines.

public getLines() : array<string|int, Line>
Return values
array<string|int, Line>

isMultiLine()

public isMultiLine() : mixed
Return values
mixed

makeMultiLine()

Take a one line doc block, and turn it into a multi line doc block.

public makeMultiLine(string $indent, string $lineEnd) : mixed
Parameters
$indent : string
$lineEnd : string
Return values
mixed

makeSingleLine()

public makeSingleLine() : mixed
Return values
mixed

findAnnotationLength()

private findAnnotationLength(mixed $start) : mixed
Parameters
$start : mixed
Return values
mixed

getSingleLineDocBlockEntry()

private getSingleLineDocBlockEntry(Line $line) : string
Parameters
$line : Line
Return values
string

Search results