TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
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 renderClosure ($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

static 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 483 of file DebuggerUtility.php.

static clearState ( )
staticprotected

Clear the state of the debugger

Returns
void

Definition at line 84 of file DebuggerUtility.php.

static 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 243 of file DebuggerUtility.php.

static 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 226 of file DebuggerUtility.php.

static 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 135 of file DebuggerUtility.php.

static renderClosure (   $object,
  $level,
  $plainText = false,
  $ansiColors = false 
)
staticprotected

Renders a dump of the given closure

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

Definition at line 205 of file DebuggerUtility.php.

static renderCollection (   $collection,
  $level,
  $plainText,
  $ansiColors 
)
staticprotected
Parameters
mixed$collection
int$level
bool$plainText
bool$ansiColors
Returns
string

Definition at line 462 of file DebuggerUtility.php.

static 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 345 of file DebuggerUtility.php.

static 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.

static 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 257 of file DebuggerUtility.php.

References debug().

static 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 175 of file DebuggerUtility.php.

static 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 506 of file DebuggerUtility.php.

Referenced by DebugUtility\renderDump(), DebugViewHelper\renderStatic(), DebuggerUtilityTest\varDumpRespectsBlacklistedClasses(), DebuggerUtilityTest\varDumpRespectsBlacklistedProperties(), and DebuggerUtilityTest\varDumpShowsPropertiesOfStdClassObjects().

Member Data Documentation

$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 = ['warning']
staticprotected

Definition at line 63 of file DebuggerUtility.php.

$maxDepth = 8
staticprotected

Definition at line 77 of file DebuggerUtility.php.

$renderedObjects
staticprotected

Definition at line 41 of file DebuggerUtility.php.

$stylesheetEchoed = false
staticprotected

Definition at line 70 of file DebuggerUtility.php.

const HTML_INDENT = '   '

Definition at line 36 of file DebuggerUtility.php.

const PLAINTEXT_INDENT = ' '

Definition at line 35 of file DebuggerUtility.php.