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

Breadcrumb

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

function DumpDataCollector::dump

Overrides DataDumperInterface::dump

File

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

Class

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

Namespace

Symfony\Component\HttpKernel\DataCollector

Code

public function dump(Data $data) : ?string {
    $this->stopwatch?->start('dump');
    [
        'name' => $name,
        'file' => $file,
        'line' => $line,
        'file_excerpt' => $fileExcerpt,
    ] = $this->sourceContextProvider
        ->getContext();
    if (!$this->dumper || $this->dumper instanceof Connection && !$this->dumper
        ->write($data)) {
        $this->isCollected = false;
    }
    $context = $data->getContext();
    $label = $context['label'] ?? '';
    unset($context['label']);
    $data = $data->withContext($context);
    if ($this->dumper && !$this->dumper instanceof Connection) {
        $this->doDump($this->dumper, $data, $name, $file, $line, $label);
    }
    if (!$this->dataCount) {
        $this->data = [];
    }
    $this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt', 'label');
    ++$this->dataCount;
    $this->stopwatch?->stop('dump');
    return null;
}
RSS feed
Powered by Drupal