PHP_CodeSniffer_DocGenerators_HTML
extends PHP_CodeSniffer_DocGenerators_Generator
in package
A doc generator that outputs documentation in one big HTML file.
Output is in one large HTML file and is designed for you to style with your own stylesheet. It contains a table of contents at the top with anchors to each sniff.
Tags
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.
- printFooter() : void
- Print the footer of the HTML page.
- printHeader() : void
- Print the header of the HTML page.
- printTextBlock() : void
- Print a text block found in a standard.
- printToc() : void
- Print the table of contents for the standard.
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
Return values
mixed —generate()
Generates the documentation for a standard.
public
generate() : void
Tags
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 —printFooter()
Print the footer of the HTML page.
protected
printFooter() : void
Return values
void —printHeader()
Print the header of the HTML page.
protected
printHeader() : void
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 —printToc()
Print the table of contents for the standard.
protected
printToc(array<string|int, mixed> $standardFiles) : void
The TOC is just an unordered list of bookmarks to sniffs on the page.
Parameters
- $standardFiles : array<string|int, mixed>
-
An array of paths to the XML standard files.