ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Profiler.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of Twig.
5  *
6  * (c) Fabien Potencier
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
13 {
14  private $actives = array();
15 
16  public function __construct(Twig_Profiler_Profile $profile)
17  {
18  $this->actives[] = $profile;
19  }
20 
21  public function enter(Twig_Profiler_Profile $profile)
22  {
23  $this->actives[0]->addProfile($profile);
24  array_unshift($this->actives, $profile);
25  }
26 
27  public function leave(Twig_Profiler_Profile $profile)
28  {
29  $profile->leave();
30  array_shift($this->actives);
31 
32  if (1 === count($this->actives)) {
33  $this->actives[0]->leave();
34  }
35  }
36 
37  public function getNodeVisitors()
38  {
39  return array(new Twig_Profiler_NodeVisitor_Profiler(get_class($this)));
40  }
41 
42  public function getName()
43  {
44  return 'profiler';
45  }
46 }
47 
48 class_alias('Twig_Extension_Profiler', 'Twig\Extension\ProfilerExtension', false);
49 class_exists('Twig_Profiler_Profile');
leave(Twig_Profiler_Profile $profile)
Definition: Profiler.php:27
getNodeVisitors()
Returns the node visitor instances to add to the existing list.
Definition: Profiler.php:37
__construct(Twig_Profiler_Profile $profile)
Definition: Profiler.php:16
getName()
Returns the name of the extension.
Definition: Profiler.php:42
enter(Twig_Profiler_Profile $profile)
Definition: Profiler.php:21
leave()
Stops the profiling.
Definition: Profile.php:139