Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DumpDataCollector.php

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\DataCollector

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal