mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-02 21:19:58 +09:00
Update composer dependencies
This commit is contained in:
@@ -25,6 +25,8 @@ use Symfony\Component\VarDumper\Server\Connection;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @final since Symfony 4.3
|
||||
*/
|
||||
class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
{
|
||||
@@ -52,12 +54,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
$this->dumper = $dumper;
|
||||
|
||||
// All clones share these properties by reference:
|
||||
$this->rootRefs = array(
|
||||
$this->rootRefs = [
|
||||
&$this->data,
|
||||
&$this->dataCount,
|
||||
&$this->isCollected,
|
||||
&$this->clonesCount,
|
||||
);
|
||||
];
|
||||
|
||||
$this->sourceContextProvider = $dumper instanceof Connection && isset($dumper->getContextProviders()['source']) ? $dumper->getContextProviders()['source'] : new SourceContextProvider($this->charset);
|
||||
}
|
||||
@@ -85,6 +87,9 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
$this->isCollected = false;
|
||||
}
|
||||
|
||||
if (!$this->dataCount) {
|
||||
$this->data = [];
|
||||
}
|
||||
$this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt');
|
||||
++$this->dataCount;
|
||||
|
||||
@@ -95,6 +100,10 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
|
||||
public function collect(Request $request, Response $response, \Exception $exception = null)
|
||||
{
|
||||
if (!$this->dataCount) {
|
||||
$this->data = [];
|
||||
}
|
||||
|
||||
// Sub-requests and programmatic calls stay in the collected profile.
|
||||
if ($this->dumper || ($this->requestStack && $this->requestStack->getMasterRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) {
|
||||
return;
|
||||
@@ -110,9 +119,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
) {
|
||||
if ($response->headers->has('Content-Type') && false !== strpos($response->headers->get('Content-Type'), 'html')) {
|
||||
$dumper = new HtmlDumper('php://output', $this->charset);
|
||||
$dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
|
||||
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
|
||||
} else {
|
||||
$dumper = new CliDumper('php://output', $this->charset);
|
||||
if (method_exists($dumper, 'setDisplayOptions')) {
|
||||
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->data as $dump) {
|
||||
@@ -126,35 +138,45 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
if ($this->stopwatch) {
|
||||
$this->stopwatch->reset();
|
||||
}
|
||||
$this->data = array();
|
||||
$this->data = [];
|
||||
$this->dataCount = 0;
|
||||
$this->isCollected = true;
|
||||
$this->clonesCount = 0;
|
||||
$this->clonesIndex = 0;
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __sleep()
|
||||
{
|
||||
if (!$this->dataCount) {
|
||||
$this->data = [];
|
||||
}
|
||||
|
||||
if ($this->clonesCount !== $this->clonesIndex) {
|
||||
return 'a:0:{}';
|
||||
return [];
|
||||
}
|
||||
|
||||
$this->data[] = $this->fileLinkFormat;
|
||||
$this->data[] = $this->charset;
|
||||
$ser = serialize($this->data);
|
||||
$this->data = array();
|
||||
$this->dataCount = 0;
|
||||
$this->isCollected = true;
|
||||
|
||||
return $ser;
|
||||
return parent::__sleep();
|
||||
}
|
||||
|
||||
public function unserialize($data)
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __wakeup()
|
||||
{
|
||||
parent::unserialize($data);
|
||||
parent::__wakeup();
|
||||
|
||||
$charset = array_pop($this->data);
|
||||
$fileLinkFormat = array_pop($this->data);
|
||||
$this->dataCount = \count($this->data);
|
||||
|
||||
self::__construct($this->stopwatch, $fileLinkFormat, $charset);
|
||||
}
|
||||
|
||||
@@ -169,11 +191,15 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
|
||||
if ('html' === $format) {
|
||||
$dumper = new HtmlDumper($data, $this->charset);
|
||||
$dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
|
||||
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
|
||||
} else {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid dump format: %s', $format));
|
||||
}
|
||||
$dumps = array();
|
||||
$dumps = [];
|
||||
|
||||
if (!$this->dataCount) {
|
||||
return $this->data = [];
|
||||
}
|
||||
|
||||
foreach ($this->data as $dump) {
|
||||
$dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)->withMaxItemsPerDepth($maxItemsPerDepth));
|
||||
@@ -193,7 +219,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
if (0 === $this->clonesCount-- && !$this->isCollected && $this->data) {
|
||||
if (0 === $this->clonesCount-- && !$this->isCollected && $this->dataCount) {
|
||||
$this->clonesCount = 0;
|
||||
$this->isCollected = true;
|
||||
|
||||
@@ -207,14 +233,17 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
if (isset($_SERVER['VAR_DUMPER_FORMAT'])) {
|
||||
$html = 'html' === $_SERVER['VAR_DUMPER_FORMAT'];
|
||||
} else {
|
||||
$html = !\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html');
|
||||
$html = !\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && stripos($h[$i], 'html');
|
||||
}
|
||||
|
||||
if ($html) {
|
||||
$dumper = new HtmlDumper('php://output', $this->charset);
|
||||
$dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
|
||||
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
|
||||
} else {
|
||||
$dumper = new CliDumper('php://output', $this->charset);
|
||||
if (method_exists($dumper, 'setDisplayOptions')) {
|
||||
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->data as $i => $dump) {
|
||||
@@ -222,7 +251,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
$this->doDump($dumper, $dump['data'], $dump['name'], $dump['file'], $dump['line']);
|
||||
}
|
||||
|
||||
$this->data = array();
|
||||
$this->data = [];
|
||||
$this->dataCount = 0;
|
||||
}
|
||||
}
|
||||
@@ -236,7 +265,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
$s = $this->style('meta', '%s');
|
||||
$f = strip_tags($this->style('', $file));
|
||||
$name = strip_tags($this->style('', $name));
|
||||
if ($fmt && $link = \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line)) {
|
||||
if ($fmt && $link = \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line)) {
|
||||
$name = sprintf('<a href="%s" title="%s">'.$s.'</a>', strip_tags($this->style('', $link)), $f, $name);
|
||||
} else {
|
||||
$name = sprintf('<abbr title="%s">'.$s.'</abbr>', $f, $name);
|
||||
|
||||
Reference in New Issue
Block a user