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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
StopwatchTokenParser.php
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
16 /**
17 * Token Parser for the stopwatch tag.
18 *
19 * @author Wouter J <wouter@wouterj.nl>
20 */
21 class StopwatchTokenParser extends \Twig_TokenParser
22 {
23 protected $stopwatchIsAvailable;
24
25 public function __construct($stopwatchIsAvailable)
26 {
27 $this->stopwatchIsAvailable = $stopwatchIsAvailable;
28 }
29
30 public function parse(\Twig_Token $token)
31 {
32 $lineno = $token->getLine();
33 $stream = $this->parser->getStream();
34
35 // {% stopwatch 'bar' %}
36 $name = $this->parser->getExpressionParser()->parseExpression();
37
38 $stream->expect(\Twig_Token::BLOCK_END_TYPE);
39
40 // {% endstopwatch %}
41 $body = $this->parser->subparse(array($this, 'decideStopwatchEnd'), true);
42 $stream->expect(\Twig_Token::BLOCK_END_TYPE);
43
44 if ($this->stopwatchIsAvailable) {
45 return new StopwatchNode($name, $body, new \Twig_Node_Expression_AssignName($this->parser->getVarName(), $token->getLine()), $lineno, $this->getTag());
46 }
47
48 return $body;
49 }
50
51 public function decideStopwatchEnd(\Twig_Token $token)
52 {
53 return $token->test('endstopwatch');
54 }
55
56 public function getTag()
57 {
58 return 'stopwatch';
59 }
60 }
61