DocblockFormatter
in package
implements
Formatter
A pretty-printer for docblocks.
Interfaces, Classes and Traits
- Formatter
- Formatter interface.
Table of Contents
- $vectorParamTemplates : mixed
- format() : string
- Format a docblock.
- formatTags() : string
- Format docblock tags.
- formatVector() : string
- Format a docblock vector, for example, `@throws`, `@param`, or `@return`.
- getVectorParamTemplate() : string
- Get a docblock vector template.
- indent() : string
- Indent a string.
- inflect() : string
- Convert underscored or whitespace separated words into sentence case.
Properties
$vectorParamTemplates
private
static mixed
$vectorParamTemplates
= ['type' => 'info', 'var' => 'strong']
Methods
format()
Format a docblock.
public
static format(Reflector $reflector) : string
Parameters
- $reflector : Reflector
Return values
string —Formatted docblock
formatTags()
Format docblock tags.
private
static formatTags(array<string|int, mixed> $skip, array<string|int, mixed> $tags) : string
Parameters
- $skip : array<string|int, mixed>
-
Tags to exclude
- $tags : array<string|int, mixed>
-
Tags to format
Return values
string —formatted tags
formatVector()
Format a docblock vector, for example, `@throws`, `@param`, or `@return`.
private
static formatVector(array<string|int, mixed> $vector, array<string|int, mixed> $lines) : string
Parameters
- $vector : array<string|int, mixed>
- $lines : array<string|int, mixed>
Tags
Return values
string —getVectorParamTemplate()
Get a docblock vector template.
private
static getVectorParamTemplate(string $type, int $max) : string
Parameters
- $type : string
-
Vector type
- $max : int
-
Pad width
Return values
string —indent()
Indent a string.
private
static indent(string $text[, string $indent = ' ' ]) : string
Parameters
- $text : string
-
String to indent
- $indent : string = ' '
-
(default: ' ')
Return values
string —inflect()
Convert underscored or whitespace separated words into sentence case.
private
static inflect(string $text) : string
Parameters
- $text : string