/** * Gets template names of templates that are present in the viewed profile. * * @param \Symfony\Component\HttpKernel\Profiler\Profile $profile * * @return array * * @throws \UnexpectedValueException */ protected function getNames(Profile $profile) { $templates = []; foreach ($this->templates as $arguments) { if (NULL === $arguments) { continue; } list($name, $template) = $arguments; if (!$this->profiler->has($name) || !$profile->hasCollector($name)) { continue; } if ('.html.twig' === substr($template, -10)) { $template = substr($template, 0, -10); } if (!$this->twigLoader->exists($template . '.html.twig')) { throw new \UnexpectedValueException(sprintf('The profiler template "%s.html.twig" for data collector "%s" does not exist.', $template, $name)); } $templates[$name] = $template . '.html.twig'; } return $templates; }