TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Extbase\Utility\DebuggerUtility Class Reference

Static Public Member Functions

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

Public Attributes

const PLAINTEXT_INDENT = ' '
 
const HTML_INDENT = '   '
 

Static Protected Member Functions

static clearState ()
 
static renderDump ($value, $level, $plainText, $ansiColors)
 
static renderArray ($array, $level, $plainText=false, $ansiColors=false)
 
static renderObject ($object, $level, $plainText=false, $ansiColors=false)
 
static isBlacklisted ($value)
 
static isAlreadyRendered ($object)
 
static renderHeader ($object, $level, $plainText, $ansiColors)
 
static renderContent ($object, $level, $plainText, $ansiColors)
 
static renderCollection ($collection, $level, $plainText, $ansiColors)
 
static ansiEscapeWrap ($string, $ansiColors, $enable=true)
 

Static Protected Attributes

static $renderedObjects
 
static $blacklistedClassNames
 
static $blacklistedPropertyNames = ['warning']
 
static $stylesheetEchoed = false
 
static $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

http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later

Definition at line 33 of file DebuggerUtility.php.

Member Function Documentation

◆ ansiEscapeWrap()

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

Wrap a string with the ANSI escape sequence for colorful output

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

Definition at line 390 of file DebuggerUtility.php.

◆ clearState()

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

Clear the state of the debugger

Returns
void

Definition at line 84 of file DebuggerUtility.php.

◆ isAlreadyRendered()

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

Checks if a given object was already rendered.

Parameters
object$object
Returns
bool TRUE if the given object was already rendered

Definition at line 217 of file DebuggerUtility.php.

◆ isBlacklisted()

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

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

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

Definition at line 200 of file DebuggerUtility.php.

◆ renderArray()

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

Renders a dump of the given array

Parameters
array | \Traversable$array
int$level
bool$plainText
bool$ansiColors
Returns
string

Definition at line 133 of file DebuggerUtility.php.

◆ renderCollection()

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

Definition at line 369 of file DebuggerUtility.php.

◆ renderContent()

static TYPO3\CMS\Extbase\Utility\DebuggerUtility::renderContent (   $object,
  $level,
  $plainText,
  $ansiColors 
)
staticprotected
Parameters
object$object
int$level
bool$plainText
bool$ansiColors
Returns
string The rendered body content of the Object(Storage)

Definition at line 319 of file DebuggerUtility.php.

◆ renderDump()

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

Renders a dump of the given value

Parameters
mixed$value
int$level
bool$plainText
bool$ansiColors
Returns
string

Definition at line 98 of file DebuggerUtility.php.

◆ renderHeader()

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

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

Parameters
object$object
int$level
bool$plainText
bool$ansiColors
Returns
string The rendered header with tags

Definition at line 231 of file DebuggerUtility.php.

References debug().

◆ renderObject()

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

Renders a dump of the given object

Parameters
object$object
int$level
bool$plainText
bool$ansiColors
Returns
string

Definition at line 173 of file DebuggerUtility.php.

◆ var_dump()

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

A var_dump function optimized for Extbase's object structures

Parameters
mixed$variableThe value to dump
string$titleoptional custom title for the debug output
int$maxDepthSets the max recursion depth of the dump. De- or increase the number according to your needs and memory limit.
bool$plainTextIf TRUE, the dump is in plain text, if FALSE the debug output is in HTML format.
bool$ansiColorsIf TRUE (default), ANSI color codes is added to the output, if FALSE the debug output not colored.
bool$returnif TRUE, the dump is returned for custom post-processing (e.g. embed in custom HTML). If FALSE (default), the dump is directly displayed.
array$blacklistedClassNamesAn array of class names (RegEx) to be filtered. Default is an array of some common class names.
array$blacklistedPropertyNamesAn 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 413 of file DebuggerUtility.php.

Referenced by TYPO3\CMS\Core\Utility\DebugUtility\renderDump(), TYPO3\CMS\Fluid\ViewHelpers\DebugViewHelper\renderStatic(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpRespectsBlacklistedClasses(), TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpRespectsBlacklistedProperties(), and TYPO3\CMS\Extbase\Tests\Unit\Utility\DebuggerUtilityTest\varDumpShowsPropertiesOfStdClassObjects().

Member Data Documentation

◆ $blacklistedClassNames

TYPO3\CMS\Extbase\Utility\DebuggerUtility::$blacklistedClassNames
staticprotected
Initial value:
= [
'PHPUnit_Framework_MockObject_InvocationMocker',
\TYPO3\CMS\Extbase\Reflection\ReflectionService::class,
\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
]

Definition at line 48 of file DebuggerUtility.php.

◆ $blacklistedPropertyNames

TYPO3\CMS\Extbase\Utility\DebuggerUtility::$blacklistedPropertyNames = ['warning']
staticprotected

Definition at line 63 of file DebuggerUtility.php.

◆ $maxDepth

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

Definition at line 77 of file DebuggerUtility.php.

◆ $renderedObjects

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

Definition at line 41 of file DebuggerUtility.php.

◆ $stylesheetEchoed

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

Definition at line 70 of file DebuggerUtility.php.

◆ HTML_INDENT

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

Definition at line 36 of file DebuggerUtility.php.

◆ PLAINTEXT_INDENT

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

Definition at line 35 of file DebuggerUtility.php.