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')) {
$dumper = new HtmlDumper('php://output', $this->charset);
} else {
$dumper = new CliDumper('php://output', $this->charset);
$dumper->setColors(false);
}
foreach ($this->data as $i => $dump) {
$this->data[$i] = null;
if ($dumper instanceof HtmlDumper) {
$dump['name'] = $this->htmlEncode($dump['name']);
$dump['file'] = $this->htmlEncode($dump['file']);
if ('' !== $dump['file']) {
if ($this->fileLinkFormat) {
$link = strtr($this->fileLinkFormat, array('%f' => $dump['file'], '%l' => $dump['line']));
$dump['name'] = sprintf('<a href="%s" title="%s">%s</a>', $link, $dump['file'], $dump['name']);
} else {
$dump['name'] = sprintf('<abbr title="%s">%s</abbr>', $dump['file'], $dump['name']);
}
}
echo "\n<span class=\"sf-dump-meta\">{$dump['name']} on line {$dump['line']}:</span>";
} else {
echo "{$dump['name']} on line {$dump['line']}:\n";
}
$dumper->dump($dump['data']);
}
$this->data = array();
$this->dataCount = 0;
}
}