private function ThemeDataCollector::computeData in Devel 8.2
Same name and namespace in other branches
- 8.3 webprofiler/src/DataCollector/ThemeDataCollector.php \Drupal\webprofiler\DataCollector\ThemeDataCollector::computeData()
- 8 webprofiler/src/DataCollector/ThemeDataCollector.php \Drupal\webprofiler\DataCollector\ThemeDataCollector::computeData()
- 4.x webprofiler/src/DataCollector/ThemeDataCollector.php \Drupal\webprofiler\DataCollector\ThemeDataCollector::computeData()
Parameters
\Twig_Profiler_Profile $profile:
Return value
array
1 call to ThemeDataCollector::computeData()
- ThemeDataCollector::getComputedData in webprofiler/
src/ DataCollector/ ThemeDataCollector.php
File
- webprofiler/
src/ DataCollector/ ThemeDataCollector.php, line 220
Class
- ThemeDataCollector
- Class ThemeDataCollector
Namespace
Drupal\webprofiler\DataCollectorCode
private function computeData(\Twig_Profiler_Profile $profile) {
$data = [
'template_count' => 0,
'block_count' => 0,
'macro_count' => 0,
];
$templates = [];
foreach ($profile as $p) {
$d = $this
->computeData($p);
$data['template_count'] += ($p
->isTemplate() ? 1 : 0) + $d['template_count'];
$data['block_count'] += ($p
->isBlock() ? 1 : 0) + $d['block_count'];
$data['macro_count'] += ($p
->isMacro() ? 1 : 0) + $d['macro_count'];
if ($p
->isTemplate()) {
if (!isset($templates[$p
->getTemplate()])) {
$templates[$p
->getTemplate()] = 1;
}
else {
$templates[$p
->getTemplate()]++;
}
}
foreach ($d['templates'] as $template => $count) {
if (!isset($templates[$template])) {
$templates[$template] = $count;
}
else {
$templates[$template] += $count;
}
}
}
$data['templates'] = $templates;
return $data;
}