DocBlock
in package
FinalYes
This class represents a docblock.
It internally splits it up into "lines" that we can manipulate.
Tags
Table of Contents
Properties
- $annotations : null|array<int, Annotation>
- $lines : array<int, Line>
- $namespace : NamespaceAnalysis|null
- $namespaceUses : array<int, NamespaceUseAnalysis>
Methods
- __construct() : mixed
- __toString() : string
- getAnnotation() : Annotation|null
- getAnnotations() : array<int, Annotation>
- Get this docblock's annotations.
- getAnnotationsOfType() : array<int, Annotation>
- Get specific types of annotations only.
- getContent() : string
- Get the actual content of this docblock.
- getLine() : Line|null
- Get a single line.
- getLines() : array<int, Line>
- Get this docblock's lines.
- isMultiLine() : bool
- makeMultiLine() : void
- Take a one line doc block, and turn it into a multi line doc block.
- makeSingleLine() : void
- findAnnotationLength() : int
- getSingleLineDocBlockEntry() : string
Properties
$annotations
private
null|array<int, Annotation>
$annotations
= null
$lines
private
array<int, Line>
$lines
= []
$namespace
private
NamespaceAnalysis|null
$namespace
$namespaceUses
private
array<int, NamespaceUseAnalysis>
$namespaceUses
Methods
__construct()
public
__construct(string $content[, NamespaceAnalysis|null $namespace = null ][, array<int, NamespaceUseAnalysis> $namespaceUses = [] ]) : mixed
Parameters
- $content : string
- $namespace : NamespaceAnalysis|null = null
- $namespaceUses : array<int, NamespaceUseAnalysis> = []
__toString()
public
__toString() : string
Return values
stringgetAnnotation()
public
getAnnotation(int $pos) : Annotation|null
Parameters
- $pos : int
Return values
Annotation|nullgetAnnotations()
Get this docblock's annotations.
public
getAnnotations() : array<int, Annotation>
Return values
array<int, Annotation>getAnnotationsOfType()
Get specific types of annotations only.
public
getAnnotationsOfType(array<int, string>|string $types) : array<int, Annotation>
Parameters
- $types : array<int, string>|string
Return values
array<int, Annotation>getContent()
Get the actual content of this docblock.
public
getContent() : string
Return values
stringgetLine()
Get a single line.
public
getLine(int $pos) : Line|null
Parameters
- $pos : int
Return values
Line|nullgetLines()
Get this docblock's lines.
public
getLines() : array<int, Line>
Return values
array<int, Line>isMultiLine()
public
isMultiLine() : bool
Return values
boolmakeMultiLine()
Take a one line doc block, and turn it into a multi line doc block.
public
makeMultiLine(string $indent, string $lineEnd) : void
Parameters
- $indent : string
- $lineEnd : string
makeSingleLine()
public
makeSingleLine() : void
findAnnotationLength()
private
findAnnotationLength(int $start) : int
Parameters
- $start : int
Return values
intgetSingleLineDocBlockEntry()
private
getSingleLineDocBlockEntry(Line $line) : string
Parameters
- $line : Line