Documentation

PHP_CodeSniffer_DocGenerators_Text extends PHP_CodeSniffer_DocGenerators_Generator
in package

A doc generator that outputs text-based documentation.

Output is designed to be displayed in a terminal and is wrapped to 100 characters.

Tags
category

PHP

author

Greg Sherwood gsherwood@squiz.net

author

Marc McIntyre mmcintyre@squiz.net

copyright

2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)

license

https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence

version

Release: @package_version@

link
http://pear.php.net/package/PHP_CodeSniffer

Table of Contents

$_sniffs  : string
An array of sniffs that we are limiting the generated docs to.
$_standard  : string
The name of the coding standard we are generating docs for.
__construct()  : mixed
Constructs a PHP_CodeSniffer_DocGenerators_Generator object.
generate()  : void
Generates the documentation for a standard.
processSniff()  : void
Process the documentation for a single sniff.
getStandard()  : string
Retrieves the name of the standard we are generating docs for.
getStandardFiles()  : array<string|int, string>
Returns a list of paths to XML standard files for all sniffs in a standard.
getTitle()  : string
Retrieves the title of the sniff from the DOMNode supplied.
printCodeComparisonBlock()  : void
Print a code comparison block found in a standard.
printTextBlock()  : void
Print a text block found in a standard.
printTitle()  : void
Prints the title area for a single sniff.

Properties

$_sniffs

An array of sniffs that we are limiting the generated docs to.

private string $_sniffs = array()

If this array is empty, docs are generated for all sniffs in the supplied coding standard.

$_standard

The name of the coding standard we are generating docs for.

private string $_standard = ''

Methods

__construct()

Constructs a PHP_CodeSniffer_DocGenerators_Generator object.

public __construct(string $standard[, array<string|int, mixed> $sniffs = array() ]) : mixed
Parameters
$standard : string

The name of the coding standard to generate docs for.

$sniffs : array<string|int, mixed> = array()

An array of sniffs that we are limiting the generated docs to.

Tags
see
generate()
Return values
mixed

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()
Return values
void

processSniff()

Process the documentation for a single sniff.

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

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

Return values
void

getStandard()

Retrieves the name of the standard we are generating docs for.

protected getStandard() : string
Return values
string

getStandardFiles()

Returns a list of paths to XML standard files for all sniffs in a standard.

protected getStandardFiles() : array<string|int, string>

Any sniffs that do not have an XML standard file are obviously not included in the returned array. If documentation is only being generated for some sniffs (ie. $this->_sniffs is not empty) then all others sniffs will be filtered from the results as well.

Return values
array<string|int, string>

getTitle()

Retrieves the title of the sniff from the DOMNode supplied.

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

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

Return values
string

printCodeComparisonBlock()

Print a code comparison block found in a standard.

protected printCodeComparisonBlock(DOMNode $node) : void
Parameters
$node : DOMNode

The DOMNode object for the code comparison block.

Return values
void

printTextBlock()

Print a text block found in a standard.

protected printTextBlock(DOMNode $node) : void
Parameters
$node : DOMNode

The DOMNode object for the text block.

Return values
void

printTitle()

Prints the title area for a single sniff.

protected printTitle(DOMNode $doc) : void
Parameters
$doc : DOMNode

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

Return values
void

Search results