Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

StopwatchExtension.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 1.23 KiB


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