vendor/pimcore/pimcore/lib/Templating/TimedPhpEngine.php line 31

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Commercial License (PCL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  13.  */
  14. namespace Pimcore\Templating;
  15. use Psr\Container\ContainerInterface;
  16. use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables;
  17. use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
  18. use Symfony\Component\Stopwatch\Stopwatch;
  19. use Symfony\Component\Templating\Loader\LoaderInterface;
  20. use Symfony\Component\Templating\TemplateNameParserInterface;
  21. /**
  22.  * Times the time spent to render a template. This is the same class as the core TimedPhpEngine, but extends our custom
  23.  * PHP engine.
  24.  *
  25.  * @deprecated since 6.8.0 and will be removed in Pimcore 10.
  26.  */
  27. class TimedPhpEngine extends PhpEngine
  28. {
  29.     /**
  30.      * @var Stopwatch
  31.      */
  32.     protected $stopwatch;
  33.     /**
  34.      * @param TemplateNameParserInterface $parser    A TemplateNameParserInterface instance
  35.      * @param ContainerInterface          $container A ContainerInterface instance
  36.      * @param LoaderInterface             $loader    A LoaderInterface instance
  37.      * @param Stopwatch                   $stopwatch A Stopwatch instance
  38.      * @param GlobalVariables             $globals   A GlobalVariables instance
  39.      */
  40.     public function __construct(TemplateNameParserInterface $parserContainerInterface $containerLoaderInterface $loaderStopwatch $stopwatchGlobalVariables $globals null)
  41.     {
  42.         parent::__construct($parser$container$loader$globals);
  43.         $this->stopwatch $stopwatch;
  44.     }
  45.     /**
  46.      * {@inheritdoc}
  47.      */
  48.     public function render($name, array $parameters = [])
  49.     {
  50.         $e $this->stopwatch->start(sprintf('template.php (%s)'$name), 'template');
  51.         /** @var TemplateReference $name */
  52.         $ret parent::render($name$parameters);
  53.         $e->stop();
  54.         return $ret;
  55.     }
  56. }