[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * This file is part of the DebugBar package. 4 * 5 * (c) 2017 Tim Riemenschneider 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 10 11 namespace DebugBar\Bridge\Twig; 12 13 use DebugBar\DataCollector\TimeDataCollector; 14 use Twig_Profiler_Profile; 15 16 /** 17 * Class TimeableTwigExtensionProfiler 18 * 19 * Extends Twig_Extension_Profiler to add rendering times to the TimeDataCollector 20 * 21 * @package DebugBar\Bridge\Twig 22 */ 23 class TimeableTwigExtensionProfiler extends \Twig_Extension_Profiler 24 { 25 /** 26 * @var \DebugBar\DataCollector\TimeDataCollector 27 */ 28 private $timeDataCollector; 29 30 /** 31 * @param \DebugBar\DataCollector\TimeDataCollector $timeDataCollector 32 */ 33 public function setTimeDataCollector(TimeDataCollector $timeDataCollector) 34 { 35 $this->timeDataCollector = $timeDataCollector; 36 } 37 38 public function __construct(\Twig_Profiler_Profile $profile, TimeDataCollector $timeDataCollector = null) 39 { 40 parent::__construct($profile); 41 42 $this->timeDataCollector = $timeDataCollector; 43 } 44 45 public function enter(Twig_Profiler_Profile $profile) 46 { 47 if ($this->timeDataCollector && $profile->isTemplate()) { 48 $this->timeDataCollector->startMeasure($profile->getName(), 'template ' . $profile->getName()); 49 } 50 parent::enter($profile); 51 } 52 53 public function leave(Twig_Profiler_Profile $profile) 54 { 55 parent::leave($profile); 56 if ($this->timeDataCollector && $profile->isTemplate()) { 57 $this->timeDataCollector->stopMeasure($profile->getName()); 58 } 59 } 60 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |