[Web] update directorytree/ldaprecord

This commit is contained in:
FreddleSpl0it
2024-02-20 10:30:11 +01:00
parent 40146839ef
commit d479d18507
481 changed files with 13919 additions and 6171 deletions
@@ -26,12 +26,15 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
public const DUMP_COMMA_SEPARATOR = 4;
public const DUMP_TRAILING_COMMA = 8;
/** @var callable|resource|string|null */
public static $defaultOutput = 'php://output';
protected $line = '';
/** @var callable|null */
protected $lineDumper;
/** @var resource|null */
protected $outputStream;
protected $decimalPoint; // This is locale dependent
protected $decimalPoint = '.';
protected $indentPad = ' ';
protected $flags;
@@ -42,12 +45,10 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
* @param string|null $charset The default character encoding to use for non-UTF8 strings
* @param int $flags A bit field of static::DUMP_* constants to fine tune dumps representation
*/
public function __construct($output = null, string $charset = null, int $flags = 0)
public function __construct($output = null, ?string $charset = null, int $flags = 0)
{
$this->flags = $flags;
$this->setCharset($charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8');
$this->decimalPoint = localeconv();
$this->decimalPoint = $this->decimalPoint['decimal_point'];
$this->setCharset($charset ?: \ini_get('php.output_encoding') ?: \ini_get('default_charset') ?: 'UTF-8');
$this->setOutput($output ?: static::$defaultOutput);
if (!$output && \is_string(static::$defaultOutput)) {
static::$defaultOutput = $this->outputStream;
@@ -57,9 +58,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Sets the output destination of the dumps.
*
* @param callable|resource|string $output A line dumper callable, an opened stream or an output path
* @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path
*
* @return callable|resource|string The previous output destination
* @return callable|resource|string|null The previous output destination
*/
public function setOutput($output)
{
@@ -73,7 +74,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
$output = fopen($output, 'w');
}
$this->outputStream = $output;
$this->lineDumper = [$this, 'echoLine'];
$this->lineDumper = $this->echoLine(...);
}
return $prev;
@@ -120,9 +121,6 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
*/
public function dump(Data $data, $output = null): ?string
{
$this->decimalPoint = localeconv();
$this->decimalPoint = $this->decimalPoint['decimal_point'];
if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(\LC_NUMERIC, 0) : null) {
setlocale(\LC_NUMERIC, 'C');
}
@@ -160,6 +158,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
*
* @param int $depth The recursive depth in the dumped structure for the line being dumped,
* or -1 to signal the end-of-dump to the line dumper callable
*
* @return void
*/
protected function dumpLine(int $depth)
{
@@ -169,6 +169,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Generic line dumper callback.
*
* @return void
*/
protected function echoLine(string $line, int $depth, string $indentPad)
{
@@ -22,6 +22,7 @@ use Symfony\Component\VarDumper\Cloner\Stub;
class CliDumper extends AbstractDumper
{
public static $defaultColors;
/** @var callable|resource|string|null */
public static $defaultOutput = 'php://stdout';
protected $colors;
@@ -51,6 +52,7 @@ class CliDumper extends AbstractDumper
"\r" => '\r',
"\033" => '\e',
];
protected static $unicodeCharsRx = "/[\u{00A0}\u{00AD}\u{034F}\u{061C}\u{115F}\u{1160}\u{17B4}\u{17B5}\u{180E}\u{2000}-\u{200F}\u{202F}\u{205F}\u{2060}-\u{2064}\u{206A}-\u{206F}\u{3000}\u{2800}\u{3164}\u{FEFF}\u{FFA0}\u{1D159}\u{1D173}-\u{1D17A}]/u";
protected $collapseNextHash = false;
protected $expandNextHash = false;
@@ -61,10 +63,7 @@ class CliDumper extends AbstractDumper
private bool $handlesHrefGracefully;
/**
* {@inheritdoc}
*/
public function __construct($output = null, string $charset = null, int $flags = 0)
public function __construct($output = null, ?string $charset = null, int $flags = 0)
{
parent::__construct($output, $charset, $flags);
@@ -83,11 +82,13 @@ class CliDumper extends AbstractDumper
]);
}
$this->displayOptions['fileLinkFormat'] = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format') ?: 'file://%f#L%l';
$this->displayOptions['fileLinkFormat'] = \ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format') ?: 'file://%f#L%l';
}
/**
* Enables/disables colored output.
*
* @return void
*/
public function setColors(bool $colors)
{
@@ -96,6 +97,8 @@ class CliDumper extends AbstractDumper
/**
* Sets the maximum number of characters per line for dumped strings.
*
* @return void
*/
public function setMaxStringWidth(int $maxStringWidth)
{
@@ -106,6 +109,8 @@ class CliDumper extends AbstractDumper
* Configures styles.
*
* @param array $styles A map of style names to style definitions
*
* @return void
*/
public function setStyles(array $styles)
{
@@ -116,6 +121,8 @@ class CliDumper extends AbstractDumper
* Configures display options.
*
* @param array $displayOptions A map of display options to customize the behavior
*
* @return void
*/
public function setDisplayOptions(array $displayOptions)
{
@@ -123,11 +130,12 @@ class CliDumper extends AbstractDumper
}
/**
* {@inheritdoc}
* @return void
*/
public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value)
{
$this->dumpKey($cursor);
$this->collapseNextHash = $this->expandNextHash = false;
$style = 'const';
$attr = $cursor->attr;
@@ -137,6 +145,11 @@ class CliDumper extends AbstractDumper
$style = 'default';
break;
case 'label':
$this->styles += ['label' => $this->styles['default']];
$style = 'label';
break;
case 'integer':
$style = 'num';
@@ -153,17 +166,12 @@ class CliDumper extends AbstractDumper
$style = 'float';
}
switch (true) {
case \INF === $value: $value = 'INF'; break;
case -\INF === $value: $value = '-INF'; break;
case is_nan($value): $value = 'NAN'; break;
default:
$value = (string) $value;
if (!str_contains($value, $this->decimalPoint)) {
$value .= $this->decimalPoint.'0';
}
break;
}
$value = match (true) {
\INF === $value => 'INF',
-\INF === $value => '-INF',
is_nan($value) => 'NAN',
default => !str_contains($value = (string) $value, $this->decimalPoint) ? $value .= $this->decimalPoint.'0' : $value,
};
break;
case 'NULL':
@@ -186,11 +194,12 @@ class CliDumper extends AbstractDumper
}
/**
* {@inheritdoc}
* @return void
*/
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut)
{
$this->dumpKey($cursor);
$this->collapseNextHash = $this->expandNextHash = false;
$attr = $cursor->attr;
if ($bin) {
@@ -198,13 +207,16 @@ class CliDumper extends AbstractDumper
}
if ('' === $str) {
$this->line .= '""';
if ($cut) {
$this->line .= '…'.$cut;
}
$this->endValue($cursor);
} else {
$attr += [
'length' => 0 <= $cut ? mb_strlen($str, 'UTF-8') + $cut : 0,
'binary' => $bin,
];
$str = $bin && false !== strpos($str, "\0") ? [$str] : explode("\n", $str);
$str = $bin && str_contains($str, "\0") ? [$str] : explode("\n", $str);
if (isset($str[1]) && !isset($str[2]) && !isset($str[1][0])) {
unset($str[1]);
$str[0] .= "\n";
@@ -274,15 +286,14 @@ class CliDumper extends AbstractDumper
}
/**
* {@inheritdoc}
* @return void
*/
public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild)
{
if (null === $this->colors) {
$this->colors = $this->supportsColors();
}
$this->colors ??= $this->supportsColors();
$this->dumpKey($cursor);
$this->expandNextHash = false;
$attr = $cursor->attr;
if ($this->collapseNextHash) {
@@ -315,7 +326,7 @@ class CliDumper extends AbstractDumper
}
/**
* {@inheritdoc}
* @return void
*/
public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut)
{
@@ -332,6 +343,8 @@ class CliDumper extends AbstractDumper
*
* @param bool $hasChild When the dump of the hash has child item
* @param int $cut The number of items the hash has been cut by
*
* @return void
*/
protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $cut)
{
@@ -348,6 +361,8 @@ class CliDumper extends AbstractDumper
/**
* Dumps a key in a hash structure.
*
* @return void
*/
protected function dumpKey(Cursor $cursor)
{
@@ -437,12 +452,11 @@ class CliDumper extends AbstractDumper
*/
protected function style(string $style, string $value, array $attr = []): string
{
if (null === $this->colors) {
$this->colors = $this->supportsColors();
}
$this->colors ??= $this->supportsColors();
$this->handlesHrefGracefully ??= 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR')
&& (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100);
&& (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100)
&& !isset($_SERVER['IDEA_INITIAL_DIRECTORY']);
if (isset($attr['ellipsis'], $attr['ellipsis-type'])) {
$prefix = substr($value, 0, -$attr['ellipsis']);
@@ -474,7 +488,15 @@ class CliDumper extends AbstractDumper
return $s.$endCchr;
}, $value, -1, $cchrCount);
if ($this->colors) {
if (!($attr['binary'] ?? false)) {
$value = preg_replace_callback(static::$unicodeCharsRx, function ($c) use (&$cchrCount, $startCchr, $endCchr) {
++$cchrCount;
return $startCchr.'\u{'.strtoupper(dechex(mb_ord($c[0]))).'}'.$endCchr;
}, $value);
}
if ($this->colors && '' !== $value) {
if ($cchrCount && "\033" === $value[0]) {
$value = substr($value, \strlen($startCchr));
} else {
@@ -497,10 +519,15 @@ class CliDumper extends AbstractDumper
}
}
if (isset($attr['href'])) {
if ('label' === $style) {
$value .= '^';
}
$value = "\033]8;;{$attr['href']}\033\\{$value}\033]8;;\033\\";
}
} elseif ($attr['if_links'] ?? false) {
return '';
}
if ('label' === $style && '' !== $value) {
$value .= ' ';
}
return $value;
@@ -511,7 +538,7 @@ class CliDumper extends AbstractDumper
if ($this->outputStream !== static::$defaultOutput) {
return $this->hasColorSupport($this->outputStream);
}
if (null !== static::$defaultColors) {
if (isset(static::$defaultColors)) {
return static::$defaultColors;
}
if (isset($_SERVER['argv'][1])) {
@@ -546,16 +573,23 @@ class CliDumper extends AbstractDumper
}
/**
* {@inheritdoc}
* @return void
*/
protected function dumpLine(int $depth, bool $endOfValue = false)
{
if (null === $this->colors) {
$this->colors = $this->supportsColors();
}
if ($this->colors) {
$this->line = sprintf("\033[%sm%s\033[m", $this->styles['default'], $this->line);
}
parent::dumpLine($depth);
}
/**
* @return void
*/
protected function endValue(Cursor $cursor)
{
if (-1 === $cursor->hashType) {
@@ -632,7 +666,7 @@ class CliDumper extends AbstractDumper
return $result;
}
private function getSourceLink(string $file, int $line)
private function getSourceLink(string $file, int $line): string|false
{
if ($fmt = $this->displayOptions['fileLinkFormat']) {
return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : ($fmt->format($file, $line) ?: 'file://'.$file.'#L'.$line);
@@ -22,8 +22,8 @@ use Symfony\Component\VarDumper\Cloner\VarCloner;
*/
final class RequestContextProvider implements ContextProviderInterface
{
private $requestStack;
private $cloner;
private RequestStack $requestStack;
private VarCloner $cloner;
public function __construct(RequestStack $requestStack)
{
@@ -11,7 +11,8 @@
namespace Symfony\Component\VarDumper\Dumper\ContextProvider;
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter;
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter as LegacyFileLinkFormatter;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
use Symfony\Component\VarDumper\VarDumper;
@@ -28,9 +29,9 @@ final class SourceContextProvider implements ContextProviderInterface
private int $limit;
private ?string $charset;
private ?string $projectDir;
private $fileLinkFormatter;
private FileLinkFormatter|LegacyFileLinkFormatter|null $fileLinkFormatter;
public function __construct(string $charset = null, string $projectDir = null, FileLinkFormatter $fileLinkFormatter = null, int $limit = 9)
public function __construct(?string $charset = null, ?string $projectDir = null, FileLinkFormatter|LegacyFileLinkFormatter|null $fileLinkFormatter = null, int $limit = 9)
{
$this->charset = $charset;
$this->projectDir = $projectDir;
@@ -44,7 +45,7 @@ final class SourceContextProvider implements ContextProviderInterface
$file = $trace[1]['file'];
$line = $trace[1]['line'];
$name = false;
$name = '-' === $file || 'Standard input code' === $file ? 'Standard input code' : false;
$fileExcerpt = false;
for ($i = 2; $i < $this->limit; ++$i) {
@@ -19,7 +19,7 @@ use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface;
*/
class ContextualizedDumper implements DataDumperInterface
{
private $wrappedDumper;
private DataDumperInterface $wrappedDumper;
private array $contextProviders;
/**
@@ -31,13 +31,16 @@ class ContextualizedDumper implements DataDumperInterface
$this->contextProviders = $contextProviders;
}
/**
* @return string|null
*/
public function dump(Data $data)
{
$context = [];
$context = $data->getContext();
foreach ($this->contextProviders as $contextProvider) {
$context[\get_class($contextProvider)] = $contextProvider->getContext();
$context[$contextProvider::class] = $contextProvider->getContext();
}
$this->wrappedDumper->dump($data->withContext($context));
return $this->wrappedDumper->dump($data->withContext($context));
}
}
@@ -20,5 +20,8 @@ use Symfony\Component\VarDumper\Cloner\Data;
*/
interface DataDumperInterface
{
/**
* @return string|null
*/
public function dump(Data $data);
}
@@ -21,6 +21,7 @@ use Symfony\Component\VarDumper\Cloner\Data;
*/
class HtmlDumper extends CliDumper
{
/** @var callable|resource|string|null */
public static $defaultOutput = 'php://output';
protected static $themes = [
@@ -74,19 +75,16 @@ class HtmlDumper extends CliDumper
];
private array $extraDisplayOptions = [];
/**
* {@inheritdoc}
*/
public function __construct($output = null, string $charset = null, int $flags = 0)
public function __construct($output = null, ?string $charset = null, int $flags = 0)
{
AbstractDumper::__construct($output, $charset, $flags);
$this->dumpId = 'sf-dump-'.mt_rand();
$this->displayOptions['fileLinkFormat'] = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
$this->displayOptions['fileLinkFormat'] = \ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
$this->styles = static::$themes['dark'] ?? self::$themes['dark'];
}
/**
* {@inheritdoc}
* @return void
*/
public function setStyles(array $styles)
{
@@ -94,6 +92,9 @@ class HtmlDumper extends CliDumper
$this->styles = $styles + $this->styles;
}
/**
* @return void
*/
public function setTheme(string $themeName)
{
if (!isset(static::$themes[$themeName])) {
@@ -107,6 +108,8 @@ class HtmlDumper extends CliDumper
* Configures display options.
*
* @param array $displayOptions A map of display options to customize the behavior
*
* @return void
*/
public function setDisplayOptions(array $displayOptions)
{
@@ -116,6 +119,8 @@ class HtmlDumper extends CliDumper
/**
* Sets an HTML header that will be dumped once in the output stream.
*
* @return void
*/
public function setDumpHeader(?string $header)
{
@@ -124,6 +129,8 @@ class HtmlDumper extends CliDumper
/**
* Sets an HTML prefix and suffix that will encapse every single dump.
*
* @return void
*/
public function setDumpBoundaries(string $prefix, string $suffix)
{
@@ -131,9 +138,6 @@ class HtmlDumper extends CliDumper
$this->dumpSuffix = $suffix;
}
/**
* {@inheritdoc}
*/
public function dump(Data $data, $output = null, array $extraDisplayOptions = []): ?string
{
$this->extraDisplayOptions = $extraDisplayOptions;
@@ -145,6 +149,8 @@ class HtmlDumper extends CliDumper
/**
* Dumps the HTML header.
*
* @return string
*/
protected function getDumpHeader()
{
@@ -158,19 +164,15 @@ class HtmlDumper extends CliDumper
<script>
Sfdump = window.Sfdump || (function (doc) {
var refStyle = doc.createElement('style'),
rxEsc = /([.*+?^${}()|\[\]\/\\])/g,
doc.documentElement.classList.add('sf-js-enabled');
var rxEsc = /([.*+?^${}()|\[\]\/\\])/g,
idRx = /\bsf-dump-\d+-ref[012]\w+\b/,
keyHint = 0 <= navigator.platform.toUpperCase().indexOf('MAC') ? 'Cmd' : 'Ctrl',
addEventListener = function (e, n, cb) {
e.addEventListener(n, cb, false);
};
refStyle.innerHTML = 'pre.sf-dump .sf-dump-compact, .sf-dump-str-collapse .sf-dump-str-collapse, .sf-dump-str-expand .sf-dump-str-expand { display: none; }';
(doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle);
refStyle = doc.createElement('style');
(doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle);
if (!doc.addEventListener) {
addEventListener = function (element, eventName, callback) {
element.attachEvent('on' + eventName, function (e) {
@@ -350,26 +352,16 @@ return function (root, x) {
function xpathHasClass(className) {
return "contains(concat(' ', normalize-space(@class), ' '), ' " + className +" ')";
}
addEventListener(root, 'mouseover', function (e) {
if ('' != refStyle.innerHTML) {
refStyle.innerHTML = '';
}
});
a('mouseover', function (a, e, c) {
if (c) {
e.target.style.cursor = "pointer";
} else if (a = idRx.exec(a.className)) {
try {
refStyle.innerHTML = 'pre.sf-dump .'+a[0]+'{background-color: #B729D9; color: #FFF !important; border-radius: 2px}';
} catch (e) {
}
}
});
a('click', function (a, e, c) {
if (/\bsf-dump-toggle\b/.test(a.className)) {
e.preventDefault();
if (!toggle(a, isCtrlKey(e))) {
var r = doc.getElementById(a.getAttribute('href').substr(1)),
var r = doc.getElementById(a.getAttribute('href').slice(1)),
s = r.previousSibling,
f = r.parentNode,
t = a.parentNode;
@@ -430,7 +422,8 @@ return function (root, x) {
x += elt.parentNode.getAttribute('data-depth')/1;
}
} else if (/\bsf-dump-ref\b/.test(elt.className) && (a = elt.getAttribute('href'))) {
a = a.substr(1);
a = a.slice(1);
elt.className += ' sf-dump-hover';
elt.className += ' '+a;
if (/[\[{]$/.test(elt.previousSibling.nodeValue)) {
@@ -647,6 +640,16 @@ return function (root, x) {
})(document);
</script><style>
.sf-js-enabled pre.sf-dump .sf-dump-compact,
.sf-js-enabled .sf-dump-str-collapse .sf-dump-str-collapse,
.sf-js-enabled .sf-dump-str-expand .sf-dump-str-expand {
display: none;
}
.sf-dump-hover:hover {
background-color: #B729D9;
color: #FFF !important;
border-radius: 2px;
}
pre.sf-dump {
display: block;
white-space: pre;
@@ -661,7 +664,7 @@ pre.sf-dump:after {
clear: both;
}
pre.sf-dump span {
display: inline;
display: inline-flex;
}
pre.sf-dump a {
text-decoration: none;
@@ -783,7 +786,7 @@ EOHTML
}
/**
* {@inheritdoc}
* @return void
*/
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut)
{
@@ -801,7 +804,7 @@ EOHTML
}
/**
* {@inheritdoc}
* @return void
*/
public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild)
{
@@ -832,7 +835,7 @@ EOHTML
}
/**
* {@inheritdoc}
* @return void
*/
public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut)
{
@@ -843,12 +846,9 @@ EOHTML
parent::leaveHash($cursor, $type, $class, $hasChild, 0);
}
/**
* {@inheritdoc}
*/
protected function style(string $style, string $value, array $attr = []): string
{
if ('' === $value) {
if ('' === $value && ('label' !== $style || !isset($attr['file']) && !isset($attr['href']))) {
return '';
}
@@ -864,7 +864,7 @@ EOHTML
}
if ('const' === $style && isset($attr['value'])) {
$style .= sprintf(' title="%s"', esc(is_scalar($attr['value']) ? $attr['value'] : json_encode($attr['value'])));
$style .= sprintf(' title="%s"', esc(\is_scalar($attr['value']) ? $attr['value'] : json_encode($attr['value'])));
} elseif ('public' === $style) {
$style .= sprintf(' title="%s"', empty($attr['dynamic']) ? 'Public property' : 'Runtime added dynamic property');
} elseif ('str' === $style && 1 < $attr['length']) {
@@ -883,7 +883,6 @@ EOHTML
} elseif ('private' === $style) {
$style .= sprintf(' title="Private property defined in class:&#10;`%s`"', esc($this->utf8Encode($attr['class'])));
}
$map = static::$controlCharsMap;
if (isset($attr['ellipsis'])) {
$class = 'sf-dump-ellipsis';
@@ -902,6 +901,7 @@ EOHTML
}
}
$map = static::$controlCharsMap;
$v = "<span class=sf-dump-{$style}>".preg_replace_callback(static::$controlCharsRx, function ($c) use ($map) {
$s = $b = '<span class="sf-dump-default';
$c = $c[$i = 0];
@@ -924,22 +924,34 @@ EOHTML
return $s.'</span>';
}, $v).'</span>';
if (!($attr['binary'] ?? false)) {
$v = preg_replace_callback(static::$unicodeCharsRx, function ($c) {
return '<span class=sf-dump-default>\u{'.strtoupper(dechex(mb_ord($c[0]))).'}</span>';
}, $v);
}
if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], $attr['line'] ?? 0)) {
$attr['href'] = $href;
}
if (isset($attr['href'])) {
if ('label' === $style) {
$v .= '^';
}
$target = isset($attr['file']) ? '' : ' target="_blank"';
$v = sprintf('<a href="%s"%s rel="noopener noreferrer">%s</a>', esc($this->utf8Encode($attr['href'])), $target, $v);
}
if (isset($attr['lang'])) {
$v = sprintf('<code class="%s">%s</code>', esc($attr['lang']), $v);
}
if ('label' === $style) {
$v .= ' ';
}
return $v;
}
/**
* {@inheritdoc}
* @return void
*/
protected function dumpLine(int $depth, bool $endOfValue = false)
{
@@ -960,7 +972,7 @@ EOHTML
}
$this->lastDepth = $depth;
$this->line = mb_convert_encoding($this->line, 'HTML-ENTITIES', 'UTF-8');
$this->line = mb_encode_numericentity($this->line, [0x80, 0x10FFFF, 0, 0x1FFFFF], 'UTF-8');
if (-1 === $depth) {
AbstractDumper::dumpLine(0);
@@ -968,7 +980,7 @@ EOHTML
AbstractDumper::dumpLine($depth);
}
private function getSourceLink(string $file, int $line)
private function getSourceLink(string $file, int $line): string|false
{
$options = $this->extraDisplayOptions + $this->displayOptions;
@@ -980,7 +992,7 @@ EOHTML
}
}
function esc(string $str)
function esc(string $str): string
{
return htmlspecialchars($str, \ENT_QUOTES, 'UTF-8');
}
@@ -22,15 +22,15 @@ use Symfony\Component\VarDumper\Server\Connection;
*/
class ServerDumper implements DataDumperInterface
{
private $connection;
private $wrappedDumper;
private Connection $connection;
private ?DataDumperInterface $wrappedDumper;
/**
* @param string $host The server host
* @param DataDumperInterface|null $wrappedDumper A wrapped instance used whenever we failed contacting the server
* @param ContextProviderInterface[] $contextProviders Context providers indexed by context name
*/
public function __construct(string $host, DataDumperInterface $wrappedDumper = null, array $contextProviders = [])
public function __construct(string $host, ?DataDumperInterface $wrappedDumper = null, array $contextProviders = [])
{
$this->connection = new Connection($host, $contextProviders);
$this->wrappedDumper = $wrappedDumper;
@@ -42,12 +42,14 @@ class ServerDumper implements DataDumperInterface
}
/**
* {@inheritdoc}
* @return string|null
*/
public function dump(Data $data)
{
if (!$this->connection->write($data) && $this->wrappedDumper) {
$this->wrappedDumper->dump($data);
return $this->wrappedDumper->dump($data);
}
return null;
}
}