You are here

public function DumpDataCollector::__destruct in Zircon Profile 8

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

File

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

Class

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

Namespace

Symfony\Component\HttpKernel\DataCollector

Code

public function __destruct() {
  if (0 === $this->clonesCount-- && !$this->isCollected && $this->data) {
    $this->clonesCount = 0;
    $this->isCollected = true;
    $h = headers_list();
    $i = count($h);
    array_unshift($h, 'Content-Type: ' . ini_get('default_mimetype'));
    while (0 !== stripos($h[$i], 'Content-Type:')) {
      --$i;
    }
    if ('cli' !== PHP_SAPI && stripos($h[$i], 'html')) {
      $this->dumper = new HtmlDumper('php://output', $this->charset);
    }
    else {
      $this->dumper = new CliDumper('php://output', $this->charset);
    }
    foreach ($this->data as $i => $dump) {
      $this->data[$i] = null;
      $this
        ->doDump($dump['data'], $dump['name'], $dump['file'], $dump['line']);
    }
    $this->data = array();
    $this->dataCount = 0;
  }
}