From f79395851b044689567e0e6c9504acbcaa742782 Mon Sep 17 00:00:00 2001 From: Benjamin Southall Date: Tue, 26 Feb 2019 10:11:12 +1000 Subject: Twig update to latest Twig 1.x legacy as per vichan --- inc/lib/Twig/Extension/Profiler.php | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 inc/lib/Twig/Extension/Profiler.php (limited to 'inc/lib/Twig/Extension/Profiler.php') diff --git a/inc/lib/Twig/Extension/Profiler.php b/inc/lib/Twig/Extension/Profiler.php new file mode 100644 index 00000000..fcfc002b --- /dev/null +++ b/inc/lib/Twig/Extension/Profiler.php @@ -0,0 +1,49 @@ +actives[] = $profile; + } + + public function enter(Twig_Profiler_Profile $profile) + { + $this->actives[0]->addProfile($profile); + array_unshift($this->actives, $profile); + } + + public function leave(Twig_Profiler_Profile $profile) + { + $profile->leave(); + array_shift($this->actives); + + if (1 === count($this->actives)) { + $this->actives[0]->leave(); + } + } + + public function getNodeVisitors() + { + return array(new Twig_Profiler_NodeVisitor_Profiler(get_class($this))); + } + + public function getName() + { + return 'profiler'; + } +} + +class_alias('Twig_Extension_Profiler', 'Twig\Extension\ProfilerExtension', false); +class_exists('Twig_Profiler_Profile'); -- cgit v1.3