DebuggerUtility

This class is a backport of the corresponding class of TYPO3 Flow.

All credits go to the TYPO3 Flow team.

A debugging utility class

Table of Contents

Constants

HTML_INDENT  = '   '
PLAINTEXT_INDENT  = ' '

Properties

$blacklistedClassNames  : array<string|int, mixed>
Hardcoded list of Extbase class names (regex) which should not be displayed during debugging
$blacklistedPropertyNames  : array<string|int, mixed>
Hardcoded list of property names (regex) which should not be displayed during debugging
$maxDepth  : int
Defines the max recursion depth of the dump, set to 8 due to common memory limits
$renderedObjects  : ObjectStorage
$stylesheetEchoed  : bool
Is set to TRUE once the CSS file is included in the current page to prevent double inclusions of the CSS file.

Methods

var_dump()  : string
A var_dump function optimized for Extbase's object structures
ansiEscapeWrap()  : string
Wrap a string with the ANSI escape sequence for colorful output
clearState()  : void
Clear the state of the debugger
isAlreadyRendered()  : bool
Checks if a given object was already rendered.
isBlacklisted()  : bool
Checks if a given object or property should be excluded/filtered
renderArray()  : string
Renders a dump of the given array
renderClosure()  : string
Renders a dump of the given closure
renderCollection()  : string
renderContent()  : string
renderDump()  : string
Renders a dump of the given value
renderHeader()  : string
Renders the header of a given object/collection. It is usually the class name along with some flags.
renderObject()  : string
Renders a dump of the given object

Constants

HTML_INDENT

public mixed HTML_INDENT = '&nbsp;&nbsp;&nbsp;'

PLAINTEXT_INDENT

public mixed PLAINTEXT_INDENT = ' '

Properties

$blacklistedClassNames

Hardcoded list of Extbase class names (regex) which should not be displayed during debugging

protected static array<string|int, mixed> $blacklistedClassNames = [ 'PHPUnit_Framework_MockObject_InvocationMocker', \TYPO3\CMS\Extbase\Reflection\ReflectionService::class, // @deprecated since v11, will be removed in v12. \TYPO3\CMS\Extbase\Object\ObjectManager::class, \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class, \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class, \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelFactory::class, \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class, ]

$blacklistedPropertyNames

Hardcoded list of property names (regex) which should not be displayed during debugging

protected static array<string|int, mixed> $blacklistedPropertyNames = ['warning']

$maxDepth

Defines the max recursion depth of the dump, set to 8 due to common memory limits

protected static int $maxDepth = 8

$stylesheetEchoed

Is set to TRUE once the CSS file is included in the current page to prevent double inclusions of the CSS file.

protected static bool $stylesheetEchoed = false

Methods

var_dump()

A var_dump function optimized for Extbase's object structures

public static var_dump(mixed $variable[, string $title = null ][, int $maxDepth = 8 ][, bool $plainText = false ][, bool $ansiColors = true ][, bool $return = false ][, array<string|int, mixed> $blacklistedClassNames = null ][, array<string|int, mixed> $blacklistedPropertyNames = null ]) : string
Parameters
$variable : mixed

The value to dump

$title : string = null

optional custom title for the debug output

$maxDepth : int = 8

Sets the max recursion depth of the dump. De- or increase the number according to your needs and memory limit.

$plainText : bool = false

If TRUE, the dump is in plain text, if FALSE the debug output is in HTML format.

$ansiColors : bool = true

If TRUE (default), ANSI color codes is added to the output, if FALSE the debug output not colored.

$return : bool = false

if TRUE, the dump is returned for custom post-processing (e.g. embed in custom HTML). If FALSE (default), the dump is directly displayed.

$blacklistedClassNames : array<string|int, mixed> = null

An array of class names (RegEx) to be filtered. Default is an array of some common class names.

$blacklistedPropertyNames : array<string|int, mixed> = null

An array of property names and/or array keys (RegEx) to be filtered. Default is an array of some common property names.

Return values
string

if $return is TRUE, the dump is returned. By default, the dump is directly displayed, and nothing is returned.

ansiEscapeWrap()

Wrap a string with the ANSI escape sequence for colorful output

protected static ansiEscapeWrap(string $string, string $ansiColors[, bool $enable = true ]) : string
Parameters
$string : string

The string to wrap

$ansiColors : string

The ansi color sequence (e.g. "1;37")

$enable : bool = true

If FALSE, the raw string will be returned

Return values
string

The wrapped or raw string

clearState()

Clear the state of the debugger

protected static clearState() : void

isAlreadyRendered()

Checks if a given object was already rendered.

protected static isAlreadyRendered(object $object) : bool
Parameters
$object : object
Return values
bool

TRUE if the given object was already rendered

isBlacklisted()

Checks if a given object or property should be excluded/filtered

protected static isBlacklisted(object $value) : bool
Parameters
$value : object

A ReflectionProperty or other Object

Return values
bool

TRUE if the given object should be filtered

renderArray()

Renders a dump of the given array

protected static renderArray(array<string|int, mixed> $array, int $level[, bool $plainText = false ][, bool $ansiColors = false ]) : string
Parameters
$array : array<string|int, mixed>
$level : int
$plainText : bool = false
$ansiColors : bool = false
Return values
string

renderClosure()

Renders a dump of the given closure

protected static renderClosure(Closure $object, int $level[, bool $plainText = false ][, bool $ansiColors = false ]) : string
Parameters
$object : Closure
$level : int
$plainText : bool = false
$ansiColors : bool = false
Return values
string

renderCollection()

protected static renderCollection(iterable<string|int, mixed> $collection, int $level, bool $plainText, bool $ansiColors) : string
Parameters
$collection : iterable<string|int, mixed>
$level : int
$plainText : bool
$ansiColors : bool
Return values
string

renderContent()

protected static renderContent(object $object, int $level, bool $plainText, bool $ansiColors) : string
Parameters
$object : object
$level : int
$plainText : bool
$ansiColors : bool
Return values
string

The rendered body content of the Object(Storage)

renderDump()

Renders a dump of the given value

protected static renderDump(mixed $value, int $level, bool $plainText, bool $ansiColors) : string
Parameters
$value : mixed
$level : int
$plainText : bool
$ansiColors : bool
Return values
string

renderHeader()

Renders the header of a given object/collection. It is usually the class name along with some flags.

protected static renderHeader(object $object, int $level, bool $plainText, bool $ansiColors) : string
Parameters
$object : object
$level : int
$plainText : bool
$ansiColors : bool
Return values
string

The rendered header with tags

renderObject()

Renders a dump of the given object

protected static renderObject(object $object, int $level[, bool $plainText = false ][, bool $ansiColors = false ]) : string
Parameters
$object : object
$level : int
$plainText : bool = false
$ansiColors : bool = false
Return values
string

        
On this page

Search results