function DumpDataCollector::getDumps
File
-
vendor/
symfony/ http-kernel/ DataCollector/ DumpDataCollector.php, line 191
Class
- DumpDataCollector
- @author Nicolas Grekas <p@tchwork.com>
Namespace
Symfony\Component\HttpKernel\DataCollectorCode
public function getDumps(string $format, int $maxDepthLimit = -1, int $maxItemsPerDepth = -1) : array {
$data = fopen('php://memory', 'r+');
if ('html' === $format) {
$dumper = new HtmlDumper($data, $this->charset);
$dumper->setDisplayOptions([
'fileLinkFormat' => $this->fileLinkFormat,
]);
}
else {
throw new \InvalidArgumentException(\sprintf('Invalid dump format: "%s".', $format));
}
$dumps = [];
if (!$this->dataCount) {
return $this->data = [];
}
foreach ($this->data as $dump) {
$dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)
->withMaxItemsPerDepth($maxItemsPerDepth));
$dump['data'] = stream_get_contents($data, -1, 0);
ftruncate($data, 0);
rewind($data);
$dumps[] = $dump;
}
return $dumps;
}