Documentation

Text extends Generator
in package

Table of Contents

Properties

$docFiles  : array<string|int, string>
XML documentation files used to produce the final output.
$ruleset  : Ruleset
The ruleset used for the run.

Methods

__construct()  : mixed
Constructs a doc generator.
generate()  : void
Generates the documentation for a standard.
processSniff()  : void
Process the documentation for a single sniff.
getFormattedCodeComparisonBlock()  : string
Format a code comparison block found in a standard.
getFormattedTextBlock()  : string
Format a text block found in a standard.
getFormattedTitle()  : string
Format the title area for a single sniff.
getTitle()  : string
Retrieves the title of the sniff from the DOMElement supplied.
codeTitleToLines()  : array<string|int, string>
Retrieve a code block title and split it into lines for use in an ASCII table.
codeToLines()  : array<string|int, string>
Retrieve a code block contents and split it into lines for use in an ASCII table.
linesToTableRows()  : string
Transform two sets of text lines into rows for use in an ASCII table.

Properties

$docFiles

XML documentation files used to produce the final output.

public array<string|int, string> $docFiles = []

Methods

__construct()

Constructs a doc generator.

public __construct(Ruleset $ruleset) : mixed
Parameters
$ruleset : Ruleset

The ruleset used for the run.

Tags
see
generate()

generate()

Generates the documentation for a standard.

public generate() : void

It's probably wise for doc generators to override this method so they have control over how the docs are produced. Otherwise, the processSniff method should be overridden to output content for each sniff.

Tags
see
processSniff()
throws
GeneratorException

If there is no element in the XML document.

processSniff()

Process the documentation for a single sniff.

public processSniff(DOMElement $doc) : void
Parameters
$doc : DOMElement

The DOMElement object for the sniff. It represents the "documentation" tag in the XML standard file.

getFormattedCodeComparisonBlock()

Format a code comparison block found in a standard.

protected getFormattedCodeComparisonBlock(DOMElement $node) : string
Parameters
$node : DOMElement

The DOMElement object for the code comparison block.

Tags
since
3.12.0

Replaces the Text::printCodeComparisonBlock() method, which was deprecated in 3.12.0 and removed in 4.0.0.

Return values
string

getFormattedTextBlock()

Format a text block found in a standard.

protected getFormattedTextBlock(DOMElement $node) : string
Parameters
$node : DOMElement

The DOMElement object for the text block.

Tags
since
3.12.0

Replaces the Text::printTextBlock() method, which was deprecated in 3.12.0 and removed in 4.0.0.

Return values
string

getFormattedTitle()

Format the title area for a single sniff.

protected getFormattedTitle(DOMElement $doc) : string
Parameters
$doc : DOMElement

The DOMElement object for the sniff. It represents the "documentation" tag in the XML standard file.

Tags
since
3.12.0

Replaces the Text::printTitle() method, which was deprecated in 3.12.0 and removed in 4.0.0.

Return values
string

getTitle()

Retrieves the title of the sniff from the DOMElement supplied.

protected getTitle(DOMElement $doc) : string
Parameters
$doc : DOMElement

The DOMElement object for the sniff. It represents the "documentation" tag in the XML standard file.

Return values
string

codeTitleToLines()

Retrieve a code block title and split it into lines for use in an ASCII table.

private codeTitleToLines(DOMElement $codeElm) : array<string|int, string>
Parameters
$codeElm : DOMElement

The DOMElement object for a code block.

Tags
since
3.12.0
Return values
array<string|int, string>

codeToLines()

Retrieve a code block contents and split it into lines for use in an ASCII table.

private codeToLines(DOMElement $codeElm) : array<string|int, string>
Parameters
$codeElm : DOMElement

The DOMElement object for a code block.

Tags
since
3.12.0
Return values
array<string|int, string>

linesToTableRows()

Transform two sets of text lines into rows for use in an ASCII table.

private linesToTableRows(array<string|int, string> $column1Lines, array<string|int, string> $column2Lines) : string

The sets may not contains an equal amount of lines, while the resulting rows should.

Parameters
$column1Lines : array<string|int, string>

Lines of text to place in column 1.

$column2Lines : array<string|int, string>

Lines of text to place in column 2.

Return values
string

        
On this page

Search results