5711fb2ec88f60a148182a12e6d7eebbaaba01b6
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Utility / DebuggerUtility.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Utility;
3
4 /* *
5 * This script belongs to the Extbase framework *
6 * *
7 * It is free software; you can redistribute it and/or modify it under *
8 * the terms of the GNU Lesser General Public License as published by the *
9 * Free Software Foundation, either version 3 of the License, or (at your *
10 * option) any later version. *
11 * *
12 * This script is distributed in the hope that it will be useful, but *
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
14 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
15 * General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License along with the script. *
19 * If not, see http://www.gnu.org/licenses/lgpl.html *
20 * *
21 * The TYPO3 project - inspiring people to share! *
22 * */
23 /**
24 * This class is a backport of the corresponding class of TYPO3 Flow.
25 * All credits go to the TYPO3 Flow team.
26 */
27 /**
28 * A debugging utility class
29 *
30 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
31 * @api
32 */
33 class DebuggerUtility
34 {
35 const PLAINTEXT_INDENT = ' ';
36 const HTML_INDENT = '&nbsp;&nbsp;&nbsp;';
37
38 /**
39 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage
40 */
41 protected static $renderedObjects;
42
43 /**
44 * Hardcoded list of Extbase class names (regex) which should not be displayed during debugging
45 *
46 * @var array
47 */
48 protected static $blacklistedClassNames = [
49 'PHPUnit_Framework_MockObject_InvocationMocker',
50 \TYPO3\CMS\Extbase\Reflection\ReflectionService::class,
51 \TYPO3\CMS\Extbase\Object\ObjectManager::class,
52 \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class,
53 \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class,
54 \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelFactory::class,
55 \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class
56 ];
57
58 /**
59 * Hardcoded list of property names (regex) which should not be displayed during debugging
60 *
61 * @var array
62 */
63 protected static $blacklistedPropertyNames = ['warning'];
64
65 /**
66 * Is set to TRUE once the CSS file is included in the current page to prevent double inclusions of the CSS file.
67 *
68 * @var bool
69 */
70 protected static $stylesheetEchoed = false;
71
72 /**
73 * Defines the max recursion depth of the dump, set to 8 due to common memory limits
74 *
75 * @var int
76 */
77 protected static $maxDepth = 8;
78
79 /**
80 * Clear the state of the debugger
81 */
82 protected static function clearState()
83 {
84 self::$renderedObjects = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
85 }
86
87 /**
88 * Renders a dump of the given value
89 *
90 * @param mixed $value
91 * @param int $level
92 * @param bool $plainText
93 * @param bool $ansiColors
94 * @return string
95 */
96 protected static function renderDump($value, $level, $plainText, $ansiColors)
97 {
98 $dump = '';
99 if (is_string($value)) {
100 $croppedValue = strlen($value) > 2000 ? substr($value, 0, 2000) . '...' : $value;
101 if ($plainText) {
102 $dump = self::ansiEscapeWrap(('"' . implode((PHP_EOL . str_repeat(self::PLAINTEXT_INDENT, ($level + 1))), str_split($croppedValue, 76)) . '"'), '33', $ansiColors) . ' (' . strlen($value) . ' chars)';
103 } else {
104 $lines = str_split($croppedValue, 76);
105 $lines = array_map('htmlspecialchars', $lines);
106 $dump = sprintf('\'<span class="extbase-debug-string">%s</span>\' (%s chars)', implode('<br />' . str_repeat(self::HTML_INDENT, $level + 1), $lines), strlen($value));
107 }
108 } elseif (is_numeric($value)) {
109 $dump = sprintf('%s (%s)', self::ansiEscapeWrap($value, '35', $ansiColors), gettype($value));
110 } elseif (is_bool($value)) {
111 $dump = $value ? self::ansiEscapeWrap('TRUE', '32', $ansiColors) : self::ansiEscapeWrap('FALSE', '32', $ansiColors);
112 } elseif (is_null($value) || is_resource($value)) {
113 $dump = gettype($value);
114 } elseif (is_array($value)) {
115 $dump = self::renderArray($value, $level + 1, $plainText, $ansiColors);
116 } elseif (is_object($value)) {
117 if ($value instanceof \Closure) {
118 $dump = self::renderClosure($value, $level + 1, $plainText, $ansiColors);
119 } else {
120 $dump = self::renderObject($value, $level + 1, $plainText, $ansiColors);
121 }
122 }
123 return $dump;
124 }
125
126 /**
127 * Renders a dump of the given array
128 *
129 * @param array|\Traversable $array
130 * @param int $level
131 * @param bool $plainText
132 * @param bool $ansiColors
133 * @return string
134 */
135 protected static function renderArray($array, $level, $plainText = false, $ansiColors = false)
136 {
137 $content = '';
138 $count = count($array);
139
140 if ($plainText) {
141 $header = self::ansiEscapeWrap('array', '36', $ansiColors);
142 } else {
143 $header = '<span class="extbase-debug-type">array</span>';
144 }
145 $header .= $count > 0 ? '(' . $count . ' item' . ($count > 1 ? 's' : '') . ')' : '(empty)';
146 if ($level >= self::$maxDepth) {
147 if ($plainText) {
148 $header .= ' ' . self::ansiEscapeWrap('max depth', '47;30', $ansiColors);
149 } else {
150 $header .= '<span class="extbase-debug-filtered">max depth</span>';
151 }
152 } else {
153 $content = self::renderCollection($array, $level, $plainText, $ansiColors);
154 if (!$plainText) {
155 $header = ($level > 1 && $count > 0 ? '<input type="checkbox" /><span class="extbase-debug-header" >' : '<span>') . $header . '</span >';
156 }
157 }
158 if ($level > 1 && $count > 0 && !$plainText) {
159 $dump = '<span class="extbase-debugger-tree">' . $header . '<span class="extbase-debug-content">' . $content . '</span></span>';
160 } else {
161 $dump = $header . $content;
162 }
163 return $dump;
164 }
165
166 /**
167 * Renders a dump of the given object
168 *
169 * @param object $object
170 * @param int $level
171 * @param bool $plainText
172 * @param bool $ansiColors
173 * @return string
174 */
175 protected static function renderObject($object, $level, $plainText = false, $ansiColors = false)
176 {
177 if ($object instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy) {
178 $object = $object->_loadRealInstance();
179 if (!$object) {
180 return gettype($object);
181 }
182 }
183 $header = self::renderHeader($object, $level, $plainText, $ansiColors);
184 if ($level < self::$maxDepth && !self::isBlacklisted($object) && !(self::isAlreadyRendered($object) && $plainText !== true)) {
185 $content = self::renderContent($object, $level, $plainText, $ansiColors);
186 } else {
187 $content = '';
188 }
189 if ($plainText) {
190 return $header . $content;
191 } else {
192 return '<span class="extbase-debugger-tree">' . $header . '<span class="extbase-debug-content">' . $content . '</span></span>';
193 }
194 }
195
196 /**
197 * Renders a dump of the given closure
198 *
199 * @param \Closure $object
200 * @param int $level
201 * @param bool $plainText
202 * @param bool $ansiColors
203 * @return string
204 */
205 protected static function renderClosure($object, $level, $plainText = false, $ansiColors = false)
206 {
207 $header = self::renderHeader($object, $level, $plainText, $ansiColors);
208 if ($level < self::$maxDepth && (!self::isAlreadyRendered($object) || $plainText)) {
209 $content = self::renderContent($object, $level, $plainText, $ansiColors);
210 } else {
211 $content = '';
212 }
213 if ($plainText) {
214 return $header . $content;
215 } else {
216 return '<span class="extbase-debugger-tree"><input type="checkbox" /><span class="extbase-debug-header">' . $header . '</span><span class="extbase-debug-content">' . $content . '</span></span>';
217 }
218 }
219
220 /**
221 * Checks if a given object or property should be excluded/filtered
222 *
223 * @param object $value An ReflectionProperty or other Object
224 * @return bool TRUE if the given object should be filtered
225 */
226 protected static function isBlacklisted($value)
227 {
228 $result = false;
229 if ($value instanceof \ReflectionProperty) {
230 $result = in_array($value->getName(), self::$blacklistedPropertyNames, true);
231 } elseif (is_object($value)) {
232 $result = in_array(get_class($value), self::$blacklistedClassNames, true);
233 }
234 return $result;
235 }
236
237 /**
238 * Checks if a given object was already rendered.
239 *
240 * @param object $object
241 * @return bool TRUE if the given object was already rendered
242 */
243 protected static function isAlreadyRendered($object)
244 {
245 return self::$renderedObjects->contains($object);
246 }
247
248 /**
249 * Renders the header of a given object/collection. It is usually the class name along with some flags.
250 *
251 * @param object $object
252 * @param int $level
253 * @param bool $plainText
254 * @param bool $ansiColors
255 * @return string The rendered header with tags
256 */
257 protected static function renderHeader($object, $level, $plainText, $ansiColors)
258 {
259 $dump = '';
260 $persistenceType = '';
261 $className = get_class($object);
262 $classReflection = new \ReflectionClass($className);
263 if ($plainText) {
264 $dump .= self::ansiEscapeWrap($className, '36', $ansiColors);
265 } else {
266 $dump .= '<span class="extbase-debug-type">' . $className . '</span>';
267 }
268 if (! $object instanceof \Closure) {
269 if ($object instanceof \TYPO3\CMS\Core\SingletonInterface) {
270 $scope = 'singleton';
271 } else {
272 $scope = 'prototype';
273 }
274 if ($plainText) {
275 $dump .= ' ' . self::ansiEscapeWrap($scope, '44;37', $ansiColors);
276 } else {
277 $dump .= $scope ? '<span class="extbase-debug-scope">' . $scope . '</span>' : '';
278 }
279 if ($object instanceof \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject) {
280 if ($object->_isDirty()) {
281 $persistenceType = 'modified';
282 } elseif ($object->_isNew()) {
283 $persistenceType = 'transient';
284 } else {
285 $persistenceType = 'persistent';
286 }
287 }
288 if ($object instanceof \TYPO3\CMS\Extbase\Persistence\ObjectStorage && $object->_isDirty()) {
289 $persistenceType = 'modified';
290 }
291 if ($object instanceof \TYPO3\CMS\Extbase\DomainObject\AbstractEntity) {
292 $domainObjectType = 'entity';
293 } elseif ($object instanceof \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject) {
294 $domainObjectType = 'valueobject';
295 } else {
296 $domainObjectType = 'object';
297 }
298 if ($plainText) {
299 $dump .= ' ' . self::ansiEscapeWrap((($persistenceType ? $persistenceType . ' ' : '') . $domainObjectType), '42;30', $ansiColors);
300 } else {
301 $dump .= '<span class="extbase-debug-ptype">' . ($persistenceType ? $persistenceType . ' ' : '') . $domainObjectType . '</span>';
302 }
303 }
304 if (strpos(implode('|', self::$blacklistedClassNames), get_class($object)) > 0) {
305 if ($plainText) {
306 $dump .= ' ' . self::ansiEscapeWrap('filtered', '47;30', $ansiColors);
307 } else {
308 $dump .= '<span class="extbase-debug-filtered">filtered</span>';
309 }
310 } elseif (self::$renderedObjects->contains($object) && !$plainText) {
311 $dump = '<a href="javascript:;" onclick="document.location.hash=\'#' . spl_object_hash($object) . '\';" class="extbase-debug-seeabove">' . $dump . '<span class="extbase-debug-filtered">see above</span></a>';
312 } elseif ($level >= self::$maxDepth && !$object instanceof \DateTime) {
313 if ($plainText) {
314 $dump .= ' ' . self::ansiEscapeWrap('max depth', '47;30', $ansiColors);
315 } else {
316 $dump .= '<span class="extbase-debug-filtered">max depth</span>';
317 }
318 } elseif ($level > 1 && !$object instanceof \DateTime && !$plainText) {
319 if (($object instanceof \Countable && empty($object)) || empty($classReflection->getProperties())) {
320 $dump = '<span>' . $dump . '</span>';
321 } else {
322 $dump = '<input type="checkbox" id="' . spl_object_hash($object) . '" /><span class="extbase-debug-header">' . $dump . '</span>';
323 }
324 }
325 if ($object instanceof \Countable) {
326 $objectCount = count($object);
327 $dump .= $objectCount > 0 ? ' (' . $objectCount . ' items)' : ' (empty)';
328 }
329 if ($object instanceof \DateTime) {
330 $dump .= ' (' . $object->format(\DateTime::RFC3339) . ', ' . $object->getTimestamp() . ')';
331 }
332 if ($object instanceof \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface && !$object->_isNew()) {
333 $dump .= ' (uid=' . $object->getUid() . ', pid=' . $object->getPid() . ')';
334 }
335 return $dump;
336 }
337
338 /**
339 * @param object $object
340 * @param int $level
341 * @param bool $plainText
342 * @param bool $ansiColors
343 * @return string The rendered body content of the Object(Storage)
344 */
345 protected static function renderContent($object, $level, $plainText, $ansiColors)
346 {
347 $dump = '';
348 if ($object instanceof \TYPO3\CMS\Extbase\Persistence\ObjectStorage || $object instanceof \Iterator || $object instanceof \ArrayObject) {
349 $dump .= self::renderCollection($object, $level, $plainText, $ansiColors);
350 } else {
351 self::$renderedObjects->attach($object);
352 if (!$plainText) {
353 $dump .= '<a name="' . spl_object_hash($object) . '" id="' . spl_object_hash($object) . '"></a>';
354 }
355 if ($object instanceof \Closure) {
356 $dump .= PHP_EOL . str_repeat(self::PLAINTEXT_INDENT, $level)
357 . ($plainText ? '' : '<span class="extbase-debug-closure">')
358 . self::ansiEscapeWrap('function (', '33', $ansiColors) . ($plainText ? '' : '</span>');
359
360 $reflectionFunction = new \ReflectionFunction($object);
361 $params = [];
362 foreach ($reflectionFunction->getParameters() as $parameter) {
363 $parameterDump = '';
364 if ($parameter->isArray()) {
365 if ($plainText) {
366 $parameterDump .= self::ansiEscapeWrap('array ', '36', $ansiColors);
367 } else {
368 $parameterDump .= '<span class="extbase-debug-type">array </span>';
369 }
370 } elseif ($parameter->getClass()) {
371 if ($plainText) {
372 $parameterDump .= self::ansiEscapeWrap($parameter->getClass()->name . ' ', '36', $ansiColors);
373 } else {
374 $parameterDump .= '<span class="extbase-debug-type">'
375 . htmlspecialchars($parameter->getClass()->name) . '</span>';
376 }
377 }
378 if ($parameter->isPassedByReference()) {
379 $parameterDump .= '&';
380 }
381 if ($plainText) {
382 $parameterDump .= self::ansiEscapeWrap('$' . $parameter->name, '37', $ansiColors);
383 } else {
384 $parameterDump .= '<span class="extbase-debug-property">'
385 . htmlspecialchars('$' . $parameter->name) . '</span>';
386 }
387 if ($parameter->isOptional()) {
388 $parameterDump .= ' = ';
389 if ($plainText) {
390 $parameterDump .= self::ansiEscapeWrap(var_export($parameter->getDefaultValue(), true), '33', $ansiColors);
391 } else {
392 $parameterDump .= '<span class="extbase-debug-string">'
393 . htmlspecialchars(var_export($parameter->getDefaultValue(), true)) . '</span>';
394 }
395 }
396 $params[] = $parameterDump;
397 }
398 $dump .= implode(', ', $params);
399 if ($plainText) {
400 $dump .= self::ansiEscapeWrap(') {' . PHP_EOL, '33', $ansiColors);
401 } else {
402 $dump .= '<span class="extbase-debug-closure">) {' . PHP_EOL . '</span>';
403 }
404 $lines = file($reflectionFunction->getFileName());
405 for ($l = $reflectionFunction->getStartLine(); $l < $reflectionFunction->getEndLine() -1; ++$l) {
406 $dump .= $plainText ? $lines[$l] : htmlspecialchars($lines[$l]);
407 }
408 $dump .= str_repeat(self::PLAINTEXT_INDENT, $level);
409 if ($plainText) {
410 $dump .= self::ansiEscapeWrap('}' . PHP_EOL, '33', $ansiColors);
411 } else {
412 $dump .= '<span class="extbase-debug-closure">}</span>';
413 }
414 } else {
415 if (get_class($object) === 'stdClass') {
416 $objReflection = new \ReflectionObject($object);
417 $properties = $objReflection->getProperties();
418 } else {
419 $classReflection = new \ReflectionClass(get_class($object));
420 $properties = $classReflection->getProperties();
421 }
422 foreach ($properties as $property) {
423 if (self::isBlacklisted($property)) {
424 continue;
425 }
426 $dump .= PHP_EOL . str_repeat(self::PLAINTEXT_INDENT, $level);
427 if ($plainText) {
428 $dump .= self::ansiEscapeWrap($property->getName(), '37', $ansiColors);
429 } else {
430 $dump .= '<span class="extbase-debug-property">'
431 . htmlspecialchars($property->getName()) . '</span>';
432 }
433 $dump .= ' => ';
434 $property->setAccessible(true);
435 $visibility = ($property->isProtected() ? 'protected' : ($property->isPrivate() ? 'private' : 'public'));
436 if ($plainText) {
437 $dump .= self::ansiEscapeWrap($visibility, '42;30', $ansiColors) . ' ';
438 } else {
439 $dump .= '<span class="extbase-debug-visibility">' . $visibility . '</span>';
440 }
441 $dump .= self::renderDump($property->getValue($object), $level, $plainText, $ansiColors);
442 if ($object instanceof \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject && !$object->_isNew() && $object->_isDirty($property->getName())) {
443 if ($plainText) {
444 $dump .= ' ' . self::ansiEscapeWrap('modified', '43;30', $ansiColors);
445 } else {
446 $dump .= '<span class="extbase-debug-dirty">modified</span>';
447 }
448 }
449 }
450 }
451 }
452 return $dump;
453 }
454
455 /**
456 * @param mixed $collection
457 * @param int $level
458 * @param bool $plainText
459 * @param bool $ansiColors
460 * @return string
461 */
462 protected static function renderCollection($collection, $level, $plainText, $ansiColors)
463 {
464 $dump = '';
465 foreach ($collection as $key => $value) {
466 $dump .= PHP_EOL . str_repeat(self::PLAINTEXT_INDENT, $level) . ($plainText ? '' : '<span class="extbase-debug-property">') . self::ansiEscapeWrap($key, '37', $ansiColors) . ($plainText ? '' : '</span>') . ' => ';
467 $dump .= self::renderDump($value, $level, $plainText, $ansiColors);
468 }
469 if ($collection instanceof \Iterator) {
470 $collection->rewind();
471 }
472 return $dump;
473 }
474
475 /**
476 * Wrap a string with the ANSI escape sequence for colorful output
477 *
478 * @param string $string The string to wrap
479 * @param string $ansiColors The ansi color sequence (e.g. "1;37")
480 * @param bool $enable If FALSE, the raw string will be returned
481 * @return string The wrapped or raw string
482 */
483 protected static function ansiEscapeWrap($string, $ansiColors, $enable = true)
484 {
485 if ($enable) {
486 return '\e[' . $ansiColors . 'm' . $string . '\e[0m';
487 } else {
488 return $string;
489 }
490 }
491
492 /**
493 * A var_dump function optimized for Extbase's object structures
494 *
495 * @param mixed $variable The value to dump
496 * @param string $title optional custom title for the debug output
497 * @param int $maxDepth Sets the max recursion depth of the dump. De- or increase the number according to your needs and memory limit.
498 * @param bool $plainText If TRUE, the dump is in plain text, if FALSE the debug output is in HTML format.
499 * @param bool $ansiColors If TRUE (default), ANSI color codes is added to the output, if FALSE the debug output not colored.
500 * @param 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.
501 * @param array $blacklistedClassNames An array of class names (RegEx) to be filtered. Default is an array of some common class names.
502 * @param array $blacklistedPropertyNames An array of property names and/or array keys (RegEx) to be filtered. Default is an array of some common property names.
503 * @return string if $return is TRUE, the dump is returned. By default, the dump is directly displayed, and nothing is returned.
504 * @api
505 */
506 public static function var_dump($variable, $title = null, $maxDepth = 8, $plainText = false, $ansiColors = true, $return = false, $blacklistedClassNames = null, $blacklistedPropertyNames = null)
507 {
508 self::$maxDepth = $maxDepth;
509 if ($title === null) {
510 $title = 'Extbase Variable Dump';
511 }
512 $ansiColors = $plainText && $ansiColors;
513 if ($ansiColors === true) {
514 $title = '\e[1m' . $title . '\e[0m';
515 }
516 $backupBlacklistedClassNames = self::$blacklistedClassNames;
517 if (is_array($blacklistedClassNames)) {
518 self::$blacklistedClassNames = $blacklistedClassNames;
519 }
520 $backupBlacklistedPropertyNames = self::$blacklistedPropertyNames;
521 if (is_array($blacklistedPropertyNames)) {
522 self::$blacklistedPropertyNames = $blacklistedPropertyNames;
523 }
524 self::clearState();
525 $css = '';
526 if (!$plainText && self::$stylesheetEchoed === false) {
527 $css = '
528 <style type=\'text/css\'>
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:999}
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-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:#698747}
548 .extbase-debugger-center .extbase-debug-dirty{background-color:#FFFFB6}
549 .extbase-debugger-center .extbase-debug-filtered{background-color:#4F4F4F}
550 .extbase-debugger-center .extbase-debug-seeabove{text-decoration:none;font-style:italic}
551 .extbase-debugger-center .extbase-debug-property{color:#f1f1f1}
552 .extbase-debugger-center .extbase-debug-closure{color:#9BA223;}
553 </style>';
554 self::$stylesheetEchoed = true;
555 }
556 if ($plainText) {
557 $output = $title . PHP_EOL . self::renderDump($variable, 0, true, $ansiColors) . PHP_EOL . PHP_EOL;
558 } else {
559 $output = '
560 <div class="extbase-debugger ' . ($return ? 'extbase-debugger-inline' : 'extbase-debugger-floating') . '">
561 <div class="extbase-debugger-top">' . htmlspecialchars($title) . '</div>
562 <div class="extbase-debugger-center">
563 <pre dir="ltr">' . self::renderDump($variable, 0, false, false) . '</pre>
564 </div>
565 </div>
566 ';
567 }
568 self::$blacklistedClassNames = $backupBlacklistedClassNames;
569 self::$blacklistedPropertyNames = $backupBlacklistedPropertyNames;
570 if ($return === true) {
571 return $css . $output;
572 } else {
573 echo $css . $output;
574 }
575 return '';
576 }
577 }