[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/symfony/twig-bridge/Extension/ -> StopwatchExtension.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Bridge\Twig\Extension;
  13  
  14  use Symfony\Bridge\Twig\TokenParser\StopwatchTokenParser;
  15  use Symfony\Component\Stopwatch\Stopwatch;
  16  use Twig\Extension\AbstractExtension;
  17  
  18  /**
  19   * Twig extension for the stopwatch helper.
  20   *
  21   * @author Wouter J <wouter@wouterj.nl>
  22   */
  23  class StopwatchExtension extends AbstractExtension
  24  {
  25      private $stopwatch;
  26      private $enabled;
  27  
  28      public function __construct(Stopwatch $stopwatch = null, $enabled = true)
  29      {
  30          $this->stopwatch = $stopwatch;
  31          $this->enabled = $enabled;
  32      }
  33  
  34      public function getStopwatch()
  35      {
  36          return $this->stopwatch;
  37      }
  38  
  39      public function getTokenParsers()
  40      {
  41          return array(
  42              /*
  43               * {% stopwatch foo %}
  44               * Some stuff which will be recorded on the timeline
  45               * {% endstopwatch %}
  46               */
  47              new StopwatchTokenParser(null !== $this->stopwatch && $this->enabled),
  48          );
  49      }
  50  
  51      public function getName()
  52      {
  53          return 'stopwatch';
  54      }
  55  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1