‪TYPO3CMS  ‪main
TYPO3\CMS\Extbase\Utility\DebuggerUtility Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Utility\DebuggerUtility:
TYPO3\CMS\Extbase\Tests\Unit\Utility\Fixtures\DebuggerUtilityAccessibleProxy

Static Public Member Functions

static string var_dump ( $variable, string $title=null, int $maxDepth=8, bool $plainText=false, bool $ansiColors=true, bool $return=false, array $blacklistedClassNames=null, array $blacklistedPropertyNames=null)
 

Public Attributes

const PLAINTEXT_INDENT = ' '
 
const HTML_INDENT = '   '
 

Static Protected Member Functions

static clearState ()
 
static renderDump ($value, int $level, bool $plainText, bool $ansiColors)
 
static renderArray (array $array, int $level, bool $plainText=false, bool $ansiColors=false)
 
static renderObject (object $object, int $level, bool $plainText=false, bool $ansiColors=false)
 
static renderClosure (\Closure $object, int $level, bool $plainText=false, bool $ansiColors=false)
 
static bool isBlacklisted (object $value)
 
static bool isAlreadyRendered (object $object)
 
static string renderHeader (object $object, int $level, bool $plainText, bool $ansiColors)
 
static string renderContent (object $object, int $level, bool $plainText, bool $ansiColors)
 
static renderCollection (iterable $collection, int $level, bool $plainText, bool $ansiColors)
 
static string ansiEscapeWrap (string $string, string $ansiColors, bool $enable=true)
 
static resolveNonceValue ()
 

Static Protected Attributes

static TYPO3 CMS Extbase Persistence ObjectStorage $renderedObjects
 
static array $blacklistedClassNames
 
static array $blacklistedPropertyNames = array( 'warning' )
 
static bool $stylesheetEchoed = false
 
static int $maxDepth = 8
 

Detailed Description

This class is a backport of the corresponding class of TYPO3 Flow. All credits go to the TYPO3 Flow team.

A debugging utility class

Definition at line 40 of file DebuggerUtility.php.

Member Function Documentation

◆ ansiEscapeWrap()

static string TYPO3\CMS\Extbase\Utility\DebuggerUtility::ansiEscapeWrap ( string  $string,
string  $ansiColors,
bool  $enable = true 
)
staticprotected

Wrap a string with the ANSI escape sequence for colorful output

Parameters
string$string‪The string to wrap
string$ansiColors‪The ansi color sequence (e.g. "1;37")
bool$enable‪If FALSE, the raw string will be returned
Returns
‪string The wrapped or raw string

Definition at line 469 of file DebuggerUtility.php.

Referenced by TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderArray(), TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderCollection(), TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderContent(), TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderDump(), and TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderHeader().

◆ clearState()

static TYPO3\CMS\Extbase\Utility\DebuggerUtility::clearState ( )
staticprotected

Clear the state of the debugger

Definition at line 83 of file DebuggerUtility.php.

Referenced by TYPO3\CMS\Extbase\Utility\DebuggerUtility\var_dump().

◆ isAlreadyRendered()

static bool TYPO3\CMS\Extbase\Utility\DebuggerUtility::isAlreadyRendered ( object  $object)
staticprotected

Checks if a given object was already rendered.

Returns
‪bool TRUE if the given object was already rendered

Definition at line 218 of file DebuggerUtility.php.

◆ isBlacklisted()

static bool TYPO3\CMS\Extbase\Utility\DebuggerUtility::isBlacklisted ( object  $value)
staticprotected

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

Parameters
object$value‪A ReflectionProperty or other Object
Returns
‪bool TRUE if the given object should be filtered

Definition at line 203 of file DebuggerUtility.php.

◆ renderArray()

static TYPO3\CMS\Extbase\Utility\DebuggerUtility::renderArray ( array  $array,
int  $level,
bool  $plainText = false,
bool  $ansiColors = false 
)
staticprotected

◆ renderClosure()

static TYPO3\CMS\Extbase\Utility\DebuggerUtility::renderClosure ( \Closure  $object,
int  $level,
bool  $plainText = false,
bool  $ansiColors = false 
)
staticprotected

◆ renderCollection()

static TYPO3\CMS\Extbase\Utility\DebuggerUtility::renderCollection ( iterable  $collection,
int  $level,
bool  $plainText,
bool  $ansiColors 
)
staticprotected

◆ renderContent()

static string TYPO3\CMS\Extbase\Utility\DebuggerUtility::renderContent ( object  $object,
int  $level,
bool  $plainText,
bool  $ansiColors 
)
staticprotected

◆ renderDump()

static TYPO3\CMS\Extbase\Utility\DebuggerUtility::renderDump (   $value,
int  $level,
bool  $plainText,
bool  $ansiColors 
)
staticprotected

◆ renderHeader()

static string TYPO3\CMS\Extbase\Utility\DebuggerUtility::renderHeader ( object  $object,
int  $level,
bool  $plainText,
bool  $ansiColors 
)
staticprotected

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

Returns
‪string The rendered header with tags

Definition at line 228 of file DebuggerUtility.php.

References TYPO3\CMS\Extbase\Persistence\ObjectStorage\_isDirty(), TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface\_isNew(), and TYPO3\CMS\Extbase\Utility\DebuggerUtility\ansiEscapeWrap().

Referenced by TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderClosure(), and TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderObject().

◆ renderObject()

static TYPO3\CMS\Extbase\Utility\DebuggerUtility::renderObject ( object  $object,
int  $level,
bool  $plainText = false,
bool  $ansiColors = false 
)
staticprotected

◆ resolveNonceValue()

static TYPO3\CMS\Extbase\Utility\DebuggerUtility::resolveNonceValue ( )
staticprotected

Definition at line 574 of file DebuggerUtility.php.

◆ var_dump()

static string TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump (   $variable,
string  $title = null,
int  $maxDepth = 8,
bool  $plainText = false,
bool  $ansiColors = true,
bool  $return = false,
array  $blacklistedClassNames = null,
array  $blacklistedPropertyNames = null 
)
static

A var_dump function optimized for Extbase's object structures

Parameters
mixed$variable‪The value to dump
string$title‪optional custom title for the debug output
int$maxDepth‪Sets the max recursion depth of the dump. De- or increase the number according to your needs and memory limit.
bool$plainText‪If TRUE, the dump is in plain text, if FALSE the debug output is in HTML format.
bool$ansiColors‪If TRUE (default), ANSI color codes is added to the output, if FALSE the debug output not colored.
bool$return‪if TRUE, the dump is returned for custom post-processing (e.g. embed in custom HTML). If FALSE (default), the dump is directly displayed.
array$blacklistedClassNames‪An array of class names (RegEx) to be filtered. Default is an array of some common class names.
array$blacklistedPropertyNames‪An array of property names and/or array keys (RegEx) to be filtered. Default is an array of some common property names.
Returns
‪string if $return is TRUE, the dump is returned. By default, the dump is directly displayed, and nothing is returned.

Definition at line 490 of file DebuggerUtility.php.

References TYPO3\CMS\Extbase\Utility\DebuggerUtility\$blacklistedClassNames, TYPO3\CMS\Extbase\Utility\DebuggerUtility\$blacklistedPropertyNames, TYPO3\CMS\Extbase\Utility\DebuggerUtility\$maxDepth, $output, TYPO3\CMS\Extbase\Utility\DebuggerUtility\clearState(), and TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderDump().

Referenced by TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\debuggerDoesNotRewindInstancesOfGenerator(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\debuggerRewindsInstancesOfIterator(), TYPO3\CMS\Core\Utility\DebugUtility\renderDump(), TYPO3\CMS\Fluid\ViewHelpers\DebugViewHelper\renderStatic(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpHandlesVariadicArguments(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpRespectsBlacklistedClasses(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpRespectsBlacklistedProperties(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsDumpOfClosureWithArrayParameterType(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsDumpOfClosureWithDummyClassParameterType(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsDumpOfClosureWithIntClassParameterType(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsDumpOfClosureWithNullableArrayParameterTypeShowingOnlyArray(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsDumpOfClosureWithoutClassParameterType(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsDumpOfClosureWithStringClassParameterType(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsDumpOfDateTime(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsDumpOfDateTimeImmutable(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsPropertiesOfStdClassObjects(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsUninitializedVariable(), and TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpUsesNonceValue().

Member Data Documentation

◆ $blacklistedClassNames

array TYPO3\CMS\Extbase\Utility\DebuggerUtility::$blacklistedClassNames
staticprotected
Initial value:
= array(
'PHPUnit_Framework_MockObject_InvocationMocker',
ReflectionService::class,
DataMapper::class,
PersistenceManager::class,
QueryObjectModelFactory::class,
ContentObjectRenderer::class,
)

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

Definition at line 53 of file DebuggerUtility.php.

Referenced by TYPO3\CMS\Extbase\Utility\DebuggerUtility\var_dump().

◆ $blacklistedPropertyNames

array TYPO3\CMS\Extbase\Utility\DebuggerUtility::$blacklistedPropertyNames = array( 'warning' )
staticprotected

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

Definition at line 66 of file DebuggerUtility.php.

Referenced by TYPO3\CMS\Extbase\Utility\DebuggerUtility\var_dump().

◆ $maxDepth

int TYPO3\CMS\Extbase\Utility\DebuggerUtility::$maxDepth = 8
staticprotected

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

Definition at line 78 of file DebuggerUtility.php.

Referenced by TYPO3\CMS\Extbase\Utility\DebuggerUtility\var_dump().

◆ $renderedObjects

TYPO3 CMS Extbase Persistence ObjectStorage TYPO3\CMS\Extbase\Utility\DebuggerUtility::$renderedObjects
staticprotected

Definition at line 47 of file DebuggerUtility.php.

◆ $stylesheetEchoed

bool TYPO3\CMS\Extbase\Utility\DebuggerUtility::$stylesheetEchoed = false
staticprotected

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

Definition at line 72 of file DebuggerUtility.php.

Referenced by TYPO3\CMS\Extbase\Tests\Unit\Utility\Fixtures\DebuggerUtilityAccessibleProxy\getStylesheetEchoed(), and TYPO3\CMS\Extbase\Tests\Unit\Utility\Fixtures\DebuggerUtilityAccessibleProxy\setStylesheetEchoed().

◆ HTML_INDENT

const TYPO3\CMS\Extbase\Utility\DebuggerUtility::HTML_INDENT = '   '

Definition at line 43 of file DebuggerUtility.php.

◆ PLAINTEXT_INDENT

const TYPO3\CMS\Extbase\Utility\DebuggerUtility::PLAINTEXT_INDENT = ' '

Definition at line 42 of file DebuggerUtility.php.