Documentation

HTML extends Generator
in package

Table of Contents

Constants

STYLESHEET  = '<style> body { background-color: #FFFFFF; font-size: 14px; font-family: Arial, Helvetica, sans-serif; color: #000000; } h1 { color: #666666; font-size: 20px; font-weight: bold; margin-top: 0px; background-color: #E6E7E8; padding: 20px; border: 1px solid #BBBBBB; } h2 { color: #00A5E3; font-size: 16px; font-weight: normal; margin-top: 50px; } h2 a.sniffanchor, h2 a.sniffanchor { color: #006C95; opacity: 0; padding: 0 3px; text-decoration: none; font-weight: bold; } h2:hover a.sniffanchor, h2:focus a.sniffanchor { opacity: 1; } .code-comparison { width: 100%; } .code-comparison td { border: 1px solid #CCCCCC; } .code-comparison-title, .code-comparison-code { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; vertical-align: top; padding: 4px; width: 50%; background-color: #F1F1F1; line-height: 15px; } .code-comparison-title { text-align: left; font-weight: 600; } .code-comparison-code { font-family: Courier; background-color: #F9F9F9; } .code-comparison-highlight { background-color: #DDF1F7; border: 1px solid #00A5E3; line-height: 15px; } .tag-line { text-align: center; width: 100%; margin-top: 30px; font-size: 12px; } .tag-line a { color: #000000; } </style>'
Stylesheet for the HTML output.

Properties

$docFiles  : array<string|int, string>
XML documentation files used to produce the final output.
$ruleset  : Ruleset
The ruleset used for the run.
$seenAnchors  : array<string, true>
List of seen slugified anchors to ensure uniqueness.

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.
getFormattedFooter()  : string
Format the footer of the HTML page.
getFormattedHeader()  : string
Format the header of the HTML page.
getFormattedTextBlock()  : string
Format a text block found in a standard.
getFormattedToc()  : string
Format the table of contents for the standard.
getTitle()  : string
Retrieves the title of the sniff from the DOMElement supplied.
formatCodeSample()  : string
Retrieve a code block contents and prepare it for output as HTML.
formatCodeTitle()  : string
Retrieve a code block title and prepare it for output as HTML.
titleToAnchor()  : string
Transform a title to a string which can be used as an HTML anchor.

Constants

STYLESHEET

Stylesheet for the HTML output.

private string STYLESHEET = '<style> body { background-color: #FFFFFF; font-size: 14px; font-family: Arial, Helvetica, sans-serif; color: #000000; } h1 { color: #666666; font-size: 20px; font-weight: bold; margin-top: 0px; background-color: #E6E7E8; padding: 20px; border: 1px solid #BBBBBB; } h2 { color: #00A5E3; font-size: 16px; font-weight: normal; margin-top: 50px; } h2 a.sniffanchor, h2 a.sniffanchor { color: #006C95; opacity: 0; padding: 0 3px; text-decoration: none; font-weight: bold; } h2:hover a.sniffanchor, h2:focus a.sniffanchor { opacity: 1; } .code-comparison { width: 100%; } .code-comparison td { border: 1px solid #CCCCCC; } .code-comparison-title, .code-comparison-code { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; vertical-align: top; padding: 4px; width: 50%; background-color: #F1F1F1; line-height: 15px; } .code-comparison-title { text-align: left; font-weight: 600; } .code-comparison-code { font-family: Courier; background-color: #F9F9F9; } .code-comparison-highlight { background-color: #DDF1F7; border: 1px solid #00A5E3; line-height: 15px; } .tag-line { text-align: center; width: 100%; margin-top: 30px; font-size: 12px; } .tag-line a { color: #000000; } </style>'

Properties

$docFiles

XML documentation files used to produce the final output.

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

$seenAnchors

List of seen slugified anchors to ensure uniqueness.

private array<string, true> $seenAnchors = []

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
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 HTML::printCodeComparisonBlock() method, which was deprecated in 3.12.0 and removed in 4.0.0.

Return values
string

getFormattedFooter()

Format the footer of the HTML page.

protected getFormattedFooter() : string
Tags
since
3.12.0

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

Return values
string

getFormattedHeader()

Format the header of the HTML page.

protected getFormattedHeader() : string
Tags
since
3.12.0

Replaces the HTML::printHeader() 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 HTML::printTextBlock() method, which was deprecated in 3.12.0 and removed in 4.0.0.

Return values
string

getFormattedToc()

Format the table of contents for the standard.

protected getFormattedToc() : string

The TOC is just an unordered list of bookmarks to sniffs on the page.

Tags
since
3.12.0

Replaces the HTML::printToc() 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

formatCodeSample()

Retrieve a code block contents and prepare it for output as HTML.

private formatCodeSample(DOMElement $codeElm) : string
Parameters
$codeElm : DOMElement

The DOMElement object for a code block.

Tags
since
3.12.0
Return values
string

formatCodeTitle()

Retrieve a code block title and prepare it for output as HTML.

private formatCodeTitle(DOMElement $codeElm) : string
Parameters
$codeElm : DOMElement

The DOMElement object for a code block.

Tags
since
3.12.0
Return values
string

titleToAnchor()

Transform a title to a string which can be used as an HTML anchor.

private titleToAnchor(string $title) : string
Parameters
$title : string

The title.

Tags
since
3.12.0
Return values
string

        
On this page

Search results