Esempio n. 1
0
 /**
  * Gets template names of templates that are present in the viewed profile.
  *
  * @param Profile $profile
  *
  * @return array
  *
  * @throws \UnexpectedValueException
  */
 protected function getNames(Profile $profile)
 {
     $templates = array();
     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->templateExists($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;
 }