timeDataCollector = $timeDataCollector; } public function __construct(\Twig_Profiler_Profile $profile, TimeDataCollector $timeDataCollector = null) { parent::__construct($profile); $this->timeDataCollector = $timeDataCollector; } public function enter(Twig_Profiler_Profile $profile) { if ($this->timeDataCollector && $profile->isTemplate()) { $this->timeDataCollector->startMeasure($profile->getName(), 'template ' . $profile->getName()); } parent::enter($profile); } public function leave(Twig_Profiler_Profile $profile) { parent::leave($profile); if ($this->timeDataCollector && $profile->isTemplate()) { $this->timeDataCollector->stopMeasure($profile->getName()); } } }