You are here

public function DumpDataCollector::getDumps in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php \Symfony\Component\HttpKernel\DataCollector\DumpDataCollector::getDumps()

File

vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php, line 196

Class

DumpDataCollector
@author Nicolas Grekas <p@tchwork.com>

Namespace

Symfony\Component\HttpKernel\DataCollector

Code

public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1) {
  $data = fopen('php://memory', 'r+b');
  if ('html' === $format) {
    $dumper = new HtmlDumper($data, $this->charset);
  }
  else {
    throw new \InvalidArgumentException(sprintf('Invalid dump format: %s', $format));
  }
  $dumps = array();
  foreach ($this->data as $dump) {
    if (method_exists($dump['data'], 'withMaxDepth')) {
      $dumper
        ->dump($dump['data']
        ->withMaxDepth($maxDepthLimit)
        ->withMaxItemsPerDepth($maxItemsPerDepth));
    }
    else {

      // getLimitedClone is @deprecated, to be removed in 3.0
      $dumper
        ->dump($dump['data']
        ->getLimitedClone($maxDepthLimit, $maxItemsPerDepth));
    }
    rewind($data);
    $dump['data'] = stream_get_contents($data);
    ftruncate($data, 0);
    rewind($data);
    $dumps[] = $dump;
  }
  return $dumps;
}