‪TYPO3CMS  ‪main
DebuggerUtility.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
33 
41 {
42  public const ‪PLAINTEXT_INDENT = ' ';
43  public const ‪HTML_INDENT = '&nbsp;&nbsp;&nbsp;';
44 
48  protected static ‪$renderedObjects;
49 
55  protected static ‪$blacklistedClassNames = [
56  'PHPUnit_Framework_MockObject_InvocationMocker',
57  ReflectionService::class,
58  DataMapper::class,
59  PersistenceManager::class,
60  QueryObjectModelFactory::class,
61  ContentObjectRenderer::class,
62  ];
63 
69  protected static ‪$blacklistedPropertyNames = ['warning'];
70 
76  protected static ‪$stylesheetEchoed = false;
77 
83  protected static ‪$maxDepth = 8;
84 
88  protected static function ‪clearState(): void
89  {
90  self::$renderedObjects = new ‪ObjectStorage();
91  }
92 
98  protected static function ‪renderDump($value, int $level, bool $plainText, bool $ansiColors): string
99  {
100  $dump = '';
101  if (is_string($value)) {
102  $croppedValue = strlen($value) > 2000 ? substr($value, 0, 2000) . '...' : $value;
103  if ($plainText) {
104  $dump = ‪self::ansiEscapeWrap('"' . implode(PHP_EOL . str_repeat(self::PLAINTEXT_INDENT, $level + 1), str_split($croppedValue, 76)) . '"', '33', $ansiColors) . ' (' . strlen($value) . ' chars)';
105  } else {
106  $lines = str_split($croppedValue, 76);
107  $lines = array_map(static fn(string $line): string => htmlspecialchars($line, ENT_COMPAT), $lines);
108  $dump = sprintf('\'<span class="extbase-debug-string">%s</span>\' (%s chars)', implode('<br />' . str_repeat(self::HTML_INDENT, $level + 1), $lines), strlen($value));
109  }
110  } elseif (is_numeric($value)) {
111  $dump = sprintf('%s (%s)', self::ansiEscapeWrap((string)$value, '35', $ansiColors), gettype($value));
112  } elseif (is_bool($value)) {
113  $dump = $value ? ‪self::ansiEscapeWrap('TRUE', '32', $ansiColors) : self::‪ansiEscapeWrap('FALSE', '32', $ansiColors);
114  } elseif ($value === null || is_resource($value)) {
115  $dump = gettype($value);
116  } elseif (is_array($value)) {
117  $dump = ‪self::renderArray($value, $level + 1, $plainText, $ansiColors);
118  } elseif (is_object($value)) {
119  if ($value instanceof \Closure) {
120  $dump = ‪self::renderClosure($value, $level + 1, $plainText, $ansiColors);
121  } else {
122  $dump = ‪self::renderObject($value, $level + 1, $plainText, $ansiColors);
123  }
124  }
125  return $dump;
126  }
127 
131  protected static function ‪renderArray(array $array, int $level, bool $plainText = false, bool $ansiColors = false): string
132  {
133  $content = '';
134  $count = count($array);
135 
136  if ($plainText) {
137  $header = ‪self::ansiEscapeWrap('array', '36', $ansiColors);
138  } else {
139  $header = '<span class="extbase-debug-type">array</span>';
140  }
141  $header .= $count > 0 ? '(' . $count . ' item' . ($count > 1 ? 's' : '') . ')' : '(empty)';
142  if ($level >= self::$maxDepth) {
143  if ($plainText) {
144  $header .= ' ' . ‪self::ansiEscapeWrap('max depth', '47;30', $ansiColors);
145  } else {
146  $header .= '<span class="extbase-debug-filtered">max depth</span>';
147  }
148  } else {
149  $content = ‪self::renderCollection($array, $level, $plainText, $ansiColors);
150  if (!$plainText) {
151  $header = ($level > 1 && $count > 0 ? '<input type="checkbox" /><span class="extbase-debug-header" >' : '<span>') . $header . '</span >';
152  }
153  }
154  if ($level > 1 && $count > 0 && !$plainText) {
155  $dump = '<span class="extbase-debugger-tree">' . $header . '<span class="extbase-debug-content">' . $content . '</span></span>';
156  } else {
157  $dump = $header . $content;
158  }
159  return $dump;
160  }
161 
165  protected static function ‪renderObject(object $object, int $level, bool $plainText = false, bool $ansiColors = false): string
166  {
167  if ($object instanceof ‪LazyLoadingProxy) {
168  $object = $object->_loadRealInstance();
169  if (!is_object($object)) {
170  return gettype($object);
171  }
172  }
173  $header = ‪self::renderHeader($object, $level, $plainText, $ansiColors);
174  if ($level < self::$maxDepth && !self::isBlacklisted($object) && !(self::isAlreadyRendered($object) && $plainText !== true)) {
175  $content = ‪self::renderContent($object, $level, $plainText, $ansiColors);
176  } else {
177  $content = '';
178  }
179  if ($plainText) {
180  return $header . $content;
181  }
182  return '<span class="extbase-debugger-tree">' . $header . '<span class="extbase-debug-content">' . $content . '</span></span>';
183  }
184 
188  protected static function ‪renderClosure(\Closure $object, int $level, bool $plainText = false, bool $ansiColors = false): string
189  {
190  $header = ‪self::renderHeader($object, $level, $plainText, $ansiColors);
191  if ($level < self::$maxDepth && (!self::isAlreadyRendered($object) || $plainText)) {
192  $content = ‪self::renderContent($object, $level, $plainText, $ansiColors);
193  } else {
194  $content = '';
195  }
196  if ($plainText) {
197  return $header . $content;
198  }
199  return '<span class="extbase-debugger-tree"><input type="checkbox" /><span class="extbase-debug-header">' . $header . '</span><span class="extbase-debug-content">' . $content . '</span></span>';
200  }
201 
208  protected static function ‪isBlacklisted(object $value): bool
209  {
210  if ($value instanceof \ReflectionProperty) {
211  $result = in_array($value->getName(), self::$blacklistedPropertyNames, true);
212  } else {
213  $result = in_array(get_class($value), self::$blacklistedClassNames, true);
214  }
215  return $result;
216  }
217 
223  protected static function ‪isAlreadyRendered(object $object): bool
224  {
225  return self::$renderedObjects->contains($object);
226  }
227 
233  protected static function ‪renderHeader(object $object, int $level, bool $plainText, bool $ansiColors): string
234  {
235  $dump = '';
236  $persistenceType = null;
237  $className = get_class($object);
238  $classReflection = new \ReflectionClass($className);
239  if ($plainText) {
240  $dump .= ‪self::ansiEscapeWrap($className, '36', $ansiColors);
241  } else {
242  $dump .= '<span class="extbase-debug-type">' . htmlspecialchars($className, ENT_COMPAT) . '</span>';
243  }
244  if (!$object instanceof \Closure) {
245  if ($object instanceof SingletonInterface) {
246  $scope = 'singleton';
247  } else {
248  $scope = 'prototype';
249  }
250  if ($plainText) {
251  $dump .= ' ' . ‪self::ansiEscapeWrap($scope, '44;37', $ansiColors);
252  } else {
253  $dump .= '<span class="extbase-debug-scope">' . $scope . '</span>';
254  }
255  if ($object instanceof DomainObjectInterface) {
256  if ($object->_isDirty()) {
257  $persistenceType = 'modified';
258  } elseif ($object->_isNew()) {
259  $persistenceType = 'transient';
260  } else {
261  $persistenceType = 'persistent';
262  }
263  }
264  if ($object instanceof ObjectStorage && $object->_isDirty()) {
265  $persistenceType = 'modified';
266  }
267  if ($object instanceof AbstractEntity) {
268  $domainObjectType = 'entity';
269  } elseif ($object instanceof AbstractValueObject) {
270  $domainObjectType = 'valueobject';
271  } else {
272  $domainObjectType = 'object';
273  }
274  $persistenceType = $persistenceType === null ? '' : $persistenceType . ' ';
275  if ($plainText) {
276  $dump .= ' ' . ‪self::ansiEscapeWrap($persistenceType . $domainObjectType, '42;30', $ansiColors);
277  } else {
278  $dump .= '<span class="extbase-debug-ptype">' . $persistenceType . $domainObjectType . '</span>';
279  }
280  }
281  if (strpos(implode('|', self::$blacklistedClassNames), get_class($object)) > 0) {
282  if ($plainText) {
283  $dump .= ' ' . ‪self::ansiEscapeWrap('filtered', '47;30', $ansiColors);
284  } else {
285  $dump .= '<span class="extbase-debug-filtered">filtered</span>';
286  }
287  } elseif (self::$renderedObjects->contains($object) && !$plainText) {
288  $dump = '<a href="#' . spl_object_hash($object) . '" class="extbase-debug-seeabove">' . $dump . '<span class="extbase-debug-filtered">see above</span></a>';
289  } elseif ($level >= self::$maxDepth && !$object instanceof \DateTimeInterface) {
290  if ($plainText) {
291  $dump .= ' ' . ‪self::ansiEscapeWrap('max depth', '47;30', $ansiColors);
292  } else {
293  $dump .= '<span class="extbase-debug-filtered">max depth</span>';
294  }
295  } elseif ($level > 1 && !$object instanceof \DateTimeInterface && !$plainText) {
296  if (($object instanceof \Countable && empty($object)) || empty($classReflection->getProperties())) {
297  $dump = '<span>' . $dump . '</span>';
298  } else {
299  $dump = '<input type="checkbox" id="' . spl_object_hash($object) . '" /><span class="extbase-debug-header">' . $dump . '</span>';
300  }
301  }
302  if ($object instanceof \Countable) {
303  $objectCount = count($object);
304  $dump .= $objectCount > 0 ? ' (' . $objectCount . ' items)' : ' (empty)';
305  }
306  if ($object instanceof \DateTimeInterface) {
307  $dump .= ' (' . $object->format(\DateTimeInterface::RFC3339) . ', ' . $object->getTimestamp() . ')';
308  }
309  if ($object instanceof DomainObjectInterface && !$object->_isNew()) {
310  $dump .= ' (uid=' . $object->getUid() . ', pid=' . $object->getPid() . ')';
311  }
312  return $dump;
313  }
314 
318  protected static function ‪renderContent(object $object, int $level, bool $plainText, bool $ansiColors): string
319  {
320  $dump = '';
321  if ($object instanceof \Iterator || $object instanceof \ArrayObject) {
322  $dump .= ‪self::renderCollection($object, $level, $plainText, $ansiColors);
323  } else {
324  self::$renderedObjects->attach($object);
325  if (!$plainText) {
326  $dump .= '<a name="' . spl_object_hash($object) . '" id="' . spl_object_hash($object) . '"></a>';
327  }
328  if ($object instanceof \Closure) {
329  $dump .= PHP_EOL . str_repeat(self::PLAINTEXT_INDENT, $level)
330  . ($plainText ? '' : '<span class="extbase-debug-closure">')
331  . self::ansiEscapeWrap('function (', '33', $ansiColors) . ($plainText ? '' : '</span>');
332 
333  $reflectionFunction = new \ReflectionFunction($object);
334  $params = [];
335  foreach ($reflectionFunction->getParameters() as $parameter) {
336  $parameterDump = '';
337  $type = $parameter->getType();
338  // @todo Following code adds for parameter of type array or a class the classname or array
339  // to the output. All other introduced possible parameter types are not respected yet.
340  // This should be extended, and also respect possible type combinations like
341  // union types and union intersect types.
342  if ($type instanceof \ReflectionNamedType && $type->isBuiltin() && $type->getName() === 'array') {
343  if ($plainText) {
344  $parameterDump .= ‪self::ansiEscapeWrap('array ', '36', $ansiColors);
345  } else {
346  $parameterDump .= '<span class="extbase-debug-type">array </span>';
347  }
348  } elseif ($type instanceof \ReflectionNamedType && !$type->isBuiltin() && !empty($type->getName())) {
349  if ($plainText) {
350  $parameterDump .= ‪self::ansiEscapeWrap($type->getName() . ' ', '36', $ansiColors);
351  } else {
352  $parameterDump .= '<span class="extbase-debug-type">'
353  . htmlspecialchars($type->getName(), ENT_COMPAT) . '</span>';
354  }
355  }
356  if ($parameter->isPassedByReference()) {
357  $parameterDump .= '&';
358  }
359  if ($parameter->isVariadic()) {
360  $parameterDump .= '...';
361  }
362  if ($plainText) {
363  $parameterDump .= ‪self::ansiEscapeWrap('$' . $parameter->name, '37', $ansiColors);
364  } else {
365  $parameterDump .= '<span class="extbase-debug-property">'
366  . htmlspecialchars('$' . $parameter->name, ENT_COMPAT) . '</span>';
367  }
368  if ($parameter->isDefaultValueAvailable()) {
369  $parameterDump .= ' = ';
370  if ($plainText) {
371  $parameterDump .= ‪self::ansiEscapeWrap(var_export($parameter->getDefaultValue(), true), '33', $ansiColors);
372  } else {
373  $parameterDump .= '<span class="extbase-debug-string">'
374  . htmlspecialchars(var_export($parameter->getDefaultValue(), true), ENT_COMPAT) . '</span>';
375  }
376  }
377  $params[] = $parameterDump;
378  }
379  $dump .= implode(', ', $params);
380  if ($plainText) {
381  $dump .= ‪self::ansiEscapeWrap(') {' . PHP_EOL, '33', $ansiColors);
382  } else {
383  $dump .= '<span class="extbase-debug-closure">) {' . PHP_EOL . '</span>';
384  }
385  $lines = (array)file((string)$reflectionFunction->getFileName());
386  for ($l = (int)$reflectionFunction->getStartLine(); $l < (int)$reflectionFunction->getEndLine() - 1; ++$l) {
387  $line = (string)($lines[$l] ?? '');
388  $dump .= $plainText ? $line : htmlspecialchars($line, ENT_COMPAT);
389  }
390  $dump .= str_repeat(self::PLAINTEXT_INDENT, $level);
391  if ($plainText) {
392  $dump .= ‪self::ansiEscapeWrap('}' . PHP_EOL, '33', $ansiColors);
393  } else {
394  $dump .= '<span class="extbase-debug-closure">}</span>';
395  }
396  } else {
397  if (get_class($object) === \stdClass::class) {
398  $objReflection = new \ReflectionObject($object);
399  $properties = $objReflection->getProperties();
400  } else {
401  $classReflection = new \ReflectionClass(get_class($object));
402  $properties = $classReflection->getProperties();
403  }
404  foreach ($properties as $property) {
405  if (self::isBlacklisted($property)) {
406  continue;
407  }
408  $dump .= PHP_EOL . str_repeat(self::PLAINTEXT_INDENT, $level);
409  if ($plainText) {
410  $dump .= ‪self::ansiEscapeWrap($property->getName(), '37', $ansiColors);
411  } else {
412  $dump .= '<span class="extbase-debug-property">'
413  . htmlspecialchars($property->getName(), ENT_COMPAT) . '</span>';
414  }
415  $dump .= ' => ';
416  $visibility = ($property->isProtected() ? 'protected' : ($property->isPrivate() ? 'private' : 'public'));
417  if ($plainText) {
418  $dump .= ‪self::ansiEscapeWrap($visibility, '42;30', $ansiColors) . ' ';
419  } else {
420  $dump .= '<span class="extbase-debug-visibility">' . $visibility . '</span>';
421  }
422  if (!$property->isInitialized($object)) {
423  if ($plainText) {
424  $dump .= ‪self::ansiEscapeWrap('uninitialized', '45;37', $ansiColors) . ' ';
425  } else {
426  $dump .= '<span class="extbase-debug-uninitialized">uninitialized</span> ';
427  }
428  continue;
429  }
430  $dump .= ‪self::renderDump($property->getValue($object), $level, $plainText, $ansiColors);
431  if ($object instanceof DomainObjectInterface && !$object->_isNew() && $object->_isDirty($property->getName())) {
432  if ($plainText) {
433  $dump .= ' ' . ‪self::ansiEscapeWrap('modified', '43;30', $ansiColors);
434  } else {
435  $dump .= '<span class="extbase-debug-dirty">modified</span>';
436  }
437  }
438  }
439  }
440  }
441  return $dump;
442  }
443 
444  protected static function ‪renderCollection(iterable $collection, int $level, bool $plainText, bool $ansiColors): string
445  {
446  $dump = '';
447  foreach ($collection as $key => $value) {
448  // Note: Due to the TYPO3\CMS\Core\Type\Map implementation, the key can also be an object.
449  $key = is_object($key) ? get_class($key) : (string)$key;
450 
451  $dump .= PHP_EOL . str_repeat(self::PLAINTEXT_INDENT, $level);
452  if ($plainText) {
453  $dump .= ‪self::ansiEscapeWrap($key, '37', $ansiColors);
454  } else {
455  $dump .= '<span class="extbase-debug-property">' . htmlspecialchars($key, ENT_COMPAT) . '</span>';
456  }
457  $dump .= ' => ';
458  $dump .= ‪self::renderDump($value, $level, $plainText, $ansiColors);
459  }
460  if ($collection instanceof \Iterator && !$collection instanceof \Generator) {
461  $collection->rewind();
462  }
463  return $dump;
464  }
465 
474  protected static function ‪ansiEscapeWrap(string $string, string $ansiColors, bool $enable = true): string
475  {
476  if ($enable) {
477  return '[' . $ansiColors . 'm' . $string . '';
478  }
479  return $string;
480  }
481 
495  public static function ‪var_dump(
496  $variable,
497  string $title = null,
498  int ‪$maxDepth = 8,
499  bool $plainText = false,
500  bool $ansiColors = true,
501  bool $return = false,
502  array ‪$blacklistedClassNames = null,
503  array ‪$blacklistedPropertyNames = null
504  ): string {
505  self::$maxDepth = ‪$maxDepth;
506  if ($title === null) {
507  $title = 'Extbase Variable Dump';
508  }
509  $ansiColors = $plainText && $ansiColors;
510  if ($ansiColors === true) {
511  $title = '' . $title . '';
512  }
513  $backupBlacklistedClassNames = ‪self::$blacklistedClassNames;
514  if (is_array(‪$blacklistedClassNames)) {
515  self::$blacklistedClassNames = ‪$blacklistedClassNames;
516  }
517  $backupBlacklistedPropertyNames = ‪self::$blacklistedPropertyNames;
518  if (is_array(‪$blacklistedPropertyNames)) {
519  self::$blacklistedPropertyNames = ‪$blacklistedPropertyNames;
520  }
522  $css = '';
523  if (!$plainText && self::$stylesheetEchoed === false) {
524  $attributes = GeneralUtility::implodeAttributes([
525  'nonce' => self::resolveNonceValue(),
526  ], true);
527  $css = '
528  <style ' . $attributes . '>
529  .extbase-debugger-tree{position:relative}
530  .extbase-debugger-tree input{position:absolute !important;float: none !important;top:0;left:0;height:14px;width:14px;margin:0 !important;cursor:pointer;opacity:0;z-index:2}
531  .extbase-debugger-tree input~.extbase-debug-content{display:none}
532  .extbase-debugger-tree .extbase-debug-header:before{position:relative;top:3px;content:"";padding:0;line-height:10px;height:12px;width:12px;text-align:center;margin:0 3px 0 0;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkViZW5lXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTIgMTIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDEyIDEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6Izg4ODg4ODt9PC9zdHlsZT48cGF0aCBpZD0iQm9yZGVyIiBjbGFzcz0ic3QwIiBkPSJNMTEsMTFIMFYwaDExVjExeiBNMTAsMUgxdjloOVYxeiIvPjxnIGlkPSJJbm5lciI+PHJlY3QgeD0iMiIgeT0iNSIgY2xhc3M9InN0MCIgd2lkdGg9IjciIGhlaWdodD0iMSIvPjxyZWN0IHg9IjUiIHk9IjIiIGNsYXNzPSJzdDAiIHdpZHRoPSIxIiBoZWlnaHQ9IjciLz48L2c+PC9zdmc+);display:inline-block}
533  .extbase-debugger-tree input:checked~.extbase-debug-content{display:inline}
534  .extbase-debugger-tree input:checked~.extbase-debug-header:before{background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkViZW5lXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTIgMTIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDEyIDEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6Izg4ODg4ODt9PC9zdHlsZT48cGF0aCBpZD0iQm9yZGVyIiBjbGFzcz0ic3QwIiBkPSJNMTEsMTFIMFYwaDExVjExeiBNMTAsMUgxdjloOVYxeiIvPjxnIGlkPSJJbm5lciI+PHJlY3QgeD0iMiIgeT0iNSIgY2xhc3M9InN0MCIgd2lkdGg9IjciIGhlaWdodD0iMSIvPjwvZz48L3N2Zz4=)}
535  .extbase-debugger{display:block;text-align:left;background:#2a2a2a;border:1px solid #2a2a2a;box-shadow:0 3px 0 rgba(0,0,0,.5);color:#000;margin:20px;overflow:hidden;border-radius:4px}
536  .extbase-debugger-floating{position:relative;z-index:99990}
537  .extbase-debugger-top{background:#444;font-size:12px;font-family:monospace;color:#f1f1f1;padding:6px 15px}
538  .extbase-debugger-center{padding:0 15px;margin:15px 0;background-image:repeating-linear-gradient(to bottom,transparent 0,transparent 20px,#252525 20px,#252525 40px)}
539  .extbase-debugger-center,.extbase-debugger-center .extbase-debug-string,.extbase-debugger-center a,.extbase-debugger-center p,.extbase-debugger-center pre,.extbase-debugger-center strong{font-size:12px;font-weight:400;font-family:monospace;line-height:20px;color:#f1f1f1}
540  .extbase-debugger-center pre{background-color:transparent;margin:0;padding:0;border:0;word-wrap:break-word;color:#999}
541  .extbase-debugger-center .extbase-debug-string{color:#ce9178;white-space:normal}
542  .extbase-debugger-center .extbase-debug-type{color:#569CD6;padding-right:4px}
543  .extbase-debugger-center .extbase-debug-unregistered{background-color:#dce1e8}
544  .extbase-debugger-center .extbase-debug-filtered,.extbase-debugger-center .extbase-debug-proxy,.extbase-debugger-center .extbase-debug-ptype,.extbase-debugger-center .extbase-debug-visibility,.extbase-debugger-center .extbase-debug-uninitialized,.extbase-debugger-center .extbase-debug-scope{color:#fff;font-size:10px;line-height:12px;padding:2px 4px;margin-right:2px;position:relative;top:-1px}
545  .extbase-debugger-center .extbase-debug-scope{background-color:#497AA2}
546  .extbase-debugger-center .extbase-debug-ptype{background-color:#698747}
547  .extbase-debugger-center .extbase-debug-visibility{background-color:#6c0787}
548  .extbase-debugger-center .extbase-debug-uninitialized{background-color:#698747}
549  .extbase-debugger-center .extbase-debug-dirty{background-color:#FFFFB6}
550  .extbase-debugger-center .extbase-debug-filtered{background-color:#4F4F4F}
551  .extbase-debugger-center .extbase-debug-seeabove{text-decoration:none;font-style:italic}
552  .extbase-debugger-center .extbase-debug-property{color:#f1f1f1}
553  .extbase-debugger-center .extbase-debug-closure{color:#9BA223;}
554  </style>';
555  self::$stylesheetEchoed = true;
556  }
557  if ($plainText) {
558  ‪$output = $title . PHP_EOL . ‪self::renderDump($variable, 0, true, $ansiColors) . PHP_EOL . PHP_EOL;
559  } else {
560  ‪$output = '
561  <div class="extbase-debugger ' . ($return ? 'extbase-debugger-inline' : 'extbase-debugger-floating') . '">
562  <div class="extbase-debugger-top">' . htmlspecialchars($title, ENT_COMPAT) . '</div>
563  <div class="extbase-debugger-center">
564  <pre dir="ltr">' . ‪self::renderDump($variable, 0, false, false) . '</pre>
565  </div>
566  </div>
567  ';
568  }
569  self::$blacklistedClassNames = $backupBlacklistedClassNames;
570  self::$blacklistedPropertyNames = $backupBlacklistedPropertyNames;
571  if ($return === true) {
572  return $css . ‪$output;
573  }
574  echo $css . ‪$output;
575 
576  return '';
577  }
578 
579  protected static function ‪resolveNonceValue(): string
580  {
581  return GeneralUtility::makeInstance(RequestId::class)->nonce->consume();
582  }
583 }
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\clearState
‪static clearState()
Definition: DebuggerUtility.php:83
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\PLAINTEXT_INDENT
‪const PLAINTEXT_INDENT
Definition: DebuggerUtility.php:42
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderCollection
‪static renderCollection(iterable $collection, int $level, bool $plainText, bool $ansiColors)
Definition: DebuggerUtility.php:439
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\$stylesheetEchoed
‪static bool $stylesheetEchoed
Definition: DebuggerUtility.php:72
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderObject
‪static renderObject(object $object, int $level, bool $plainText=false, bool $ansiColors=false)
Definition: DebuggerUtility.php:160
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\resolveNonceValue
‪static resolveNonceValue()
Definition: DebuggerUtility.php:574
‪TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelFactory
Definition: QueryObjectModelFactory.php:30
‪TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper
Definition: DataMapper.php:58
‪TYPO3\CMS\Extbase\DomainObject\AbstractEntity
Definition: AbstractEntity.php:22
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\$maxDepth
‪static int $maxDepth
Definition: DebuggerUtility.php:78
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\$renderedObjects
‪static TYPO3 CMS Extbase Persistence ObjectStorage $renderedObjects
Definition: DebuggerUtility.php:47
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\$blacklistedClassNames
‪static array $blacklistedClassNames
Definition: DebuggerUtility.php:53
‪TYPO3\CMS\Extbase\Persistence\ObjectStorage
Definition: ObjectStorage.php:34
‪TYPO3\CMS\Extbase\Reflection\ReflectionService
Definition: ReflectionService.php:28
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderContent
‪static string renderContent(object $object, int $level, bool $plainText, bool $ansiColors)
Definition: DebuggerUtility.php:313
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\ansiEscapeWrap
‪static string ansiEscapeWrap(string $string, string $ansiColors, bool $enable=true)
Definition: DebuggerUtility.php:469
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\var_dump
‪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)
Definition: DebuggerUtility.php:490
‪TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface\_isNew
‪_isNew()
‪TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
Definition: AbstractValueObject.php:26
‪TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface
Definition: DomainObjectInterface.php:33
‪TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager
Definition: PersistenceManager.php:30
‪TYPO3\CMS\Core\Core\RequestId
Definition: RequestId.php:26
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderHeader
‪static string renderHeader(object $object, int $level, bool $plainText, bool $ansiColors)
Definition: DebuggerUtility.php:228
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility
Definition: DebuggerUtility.php:41
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\$blacklistedPropertyNames
‪static array $blacklistedPropertyNames
Definition: DebuggerUtility.php:66
‪$output
‪$output
Definition: annotationChecker.php:114
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\isBlacklisted
‪static bool isBlacklisted(object $value)
Definition: DebuggerUtility.php:203
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\HTML_INDENT
‪const HTML_INDENT
Definition: DebuggerUtility.php:43
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderClosure
‪static renderClosure(\Closure $object, int $level, bool $plainText=false, bool $ansiColors=false)
Definition: DebuggerUtility.php:183
‪TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy
Definition: LazyLoadingProxy.php:30
‪TYPO3\CMS\Core\SingletonInterface
Definition: SingletonInterface.php:22
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition: ContentObjectRenderer.php:102
‪TYPO3\CMS\Extbase\Utility
Definition: DebuggerUtility.php:18
‪TYPO3\CMS\Extbase\Persistence\ObjectStorage\_isDirty
‪_isDirty(?string $propertyName=null)
Definition: ObjectStorage.php:328
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\isAlreadyRendered
‪static bool isAlreadyRendered(object $object)
Definition: DebuggerUtility.php:218
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderDump
‪static renderDump($value, int $level, bool $plainText, bool $ansiColors)
Definition: DebuggerUtility.php:93
‪TYPO3\CMS\Extbase\Utility\DebuggerUtility\renderArray
‪static renderArray(array $array, int $level, bool $plainText=false, bool $ansiColors=false)
Definition: DebuggerUtility.php:126