Example #1
0
 public function testConstructor()
 {
     $profile = new Twig_Profiler_Profile('template', 'type', 'name');
     $this->assertEquals('template', $profile->getTemplate());
     $this->assertEquals('type', $profile->getType());
     $this->assertEquals('name', $profile->getName());
 }
Example #2
0
 private function format(\Twig_Profiler_Profile $profile)
 {
     $tmp = array();
     $tmp["template"] = $profile->getTemplate();
     $tmp["name"] = $profile->getName();
     $tmp["duration"] = $profile->getDuration();
     $tmp["type"] = $profile->getType();
     return $tmp;
 }
Example #3
0
 protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix)
 {
     return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName());
 }
Example #4
0
 protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix)
 {
     return sprintf('%s└ %s::%s(<span style="background-color: %s">%s</span>)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName());
 }
 protected function incTemplateCount(\Twig_Profiler_Profile $p, $templates)
 {
     if ($p->isTemplate()) {
         if (!isset($templates[$p->getTemplate()])) {
             $templates[$p->getTemplate()] = 1;
         } else {
             ++$templates[$p->getTemplate()];
         }
     }
     return $templates;
 }