Documentation

PHP_CodeSniffer_DocGenerators_Generator
in package

The base class for all PHP_CodeSniffer documentation generators.

Documentation generators are used to print documentation about code sniffs in a standard.

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.
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.
processSniff()  : void
Process the documentation 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

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

processSniff()

Process the documentation for a single sniff.

protected abstract processSniff(DOMNode $doc) : void

Doc generators must implement this function to produce output.

Parameters
$doc : DOMNode

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

Tags
see
generate()
Return values
void

Search results