Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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

StopwatchTokenParser.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 1.57 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\TokenParser;
13   
14  use Symfony\Bridge\Twig\Node\StopwatchNode;
15  use Twig\Node\Expression\AssignNameExpression;
16  use Twig\Token;
17  use Twig\TokenParser\AbstractTokenParser;
18   
19  /**
20   * Token Parser for the stopwatch tag.
21   *
22   * @author Wouter J <wouter@wouterj.nl>
23   */
24  class StopwatchTokenParser extends AbstractTokenParser
25  {
26      protected $stopwatchIsAvailable;
27   
28      public function __construct($stopwatchIsAvailable)
29      {
30          $this->stopwatchIsAvailable = $stopwatchIsAvailable;
31      }
32   
33      public function parse(Token $token)
34      {
35          $lineno = $token->getLine();
36          $stream = $this->parser->getStream();
37   
38          // {% stopwatch 'bar' %}
39          $name = $this->parser->getExpressionParser()->parseExpression();
40   
41          $stream->expect(Token::BLOCK_END_TYPE);
42   
43          // {% endstopwatch %}
44          $body = $this->parser->subparse([$this, 'decideStopwatchEnd'], true);
45          $stream->expect(Token::BLOCK_END_TYPE);
46   
47          if ($this->stopwatchIsAvailable) {
48              return new StopwatchNode($name, $body, new AssignNameExpression($this->parser->getVarName(), $token->getLine()), $lineno, $this->getTag());
49          }
50   
51          return $body;
52      }
53   
54      public function decideStopwatchEnd(Token $token)
55      {
56          return $token->test('endstopwatch');
57      }
58   
59      public function getTag()
60      {
61          return 'stopwatch';
62      }
63  }
64