W3cubDocs

/CakePHP 4.4

Class HtmlFormatter

A Debugger formatter for generating interactive styled HTML output.

Namespace: Cake\Error\Debug

Property Summary

  • $id protected
    string

    Random id so that HTML ids are not shared between dump outputs.

  • $outputHeader protected static
    bool

Method Summary

  • __construct() public

    Constructor.

  • dump() public

    Convert a tree of NodeInterface objects into HTML

  • dumpHeader() protected

    Generate the CSS and Javascript for dumps

  • environmentMatches() public static

    Check if the current environment is not a CLI context

  • export() protected

    Convert a tree of NodeInterface objects into HTML

  • exportArray() protected

    Export an array type object

  • exportObject() protected

    Handles object to string conversion.

  • formatWrapper() public

    Output a dump wrapper with location context.

  • style() protected

    Style text with HTML class names

Method Detail

__construct() public

__construct()

Constructor.

dump() public

dump(Cake\Error\Debug\NodeInterface $node): string

Convert a tree of NodeInterface objects into HTML

Parameters

Cake\Error\Debug\NodeInterface $node

The node tree to dump.

Returns

string

dumpHeader() protected

dumpHeader(): string

Generate the CSS and Javascript for dumps

Only output once per process as we don't need it more than once.

Returns

string

environmentMatches() public static

environmentMatches(): bool

Check if the current environment is not a CLI context

Returns

bool

export() protected

export(Cake\Error\Debug\NodeInterface $var, int $indent): string

Convert a tree of NodeInterface objects into HTML

Parameters

Cake\Error\Debug\NodeInterface $var

The node tree to dump.

int $indent

The current indentation level.

Returns

string

exportArray() protected

exportArray(Cake\Error\Debug\ArrayNode $var, int $indent): string

Export an array type object

Parameters

Cake\Error\Debug\ArrayNode $var

The array to export.

int $indent

The current indentation level.

Returns

string

exportObject() protected

exportObject(Cake\Error\Debug\ClassNodeCake\Error\Debug\ReferenceNode $var, int $indent): string

Handles object to string conversion.

Parameters

Cake\Error\Debug\ClassNodeCake\Error\Debug\ReferenceNode $var

Object to convert.

int $indent

The current indentation level.

Returns

string

See Also

\Cake\Error\Debugger::exportVar()

formatWrapper() public

formatWrapper(string $contents, array $location): string

Output a dump wrapper with location context.

Parameters

string $contents
array $location

Returns

string

style() protected

style(string $style, string $text): string

Style text with HTML class names

Parameters

string $style

The style name to use.

string $text

The text to style.

Returns

string

Property Detail

$id protected

Random id so that HTML ids are not shared between dump outputs.

Type

string

$outputHeader protected static

Type

bool

© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.Error.Debug.HtmlFormatter.html