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

IfNode.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 1.80 KiB


01  <?php
02   
03  /*
04   * This file is part of Twig.
05   *
06   * (c) Fabien Potencier
07   * (c) Armin Ronacher
08   *
09   * For the full copyright and license information, please view the LICENSE
10   * file that was distributed with this source code.
11   */
12   
13  namespace Twig\Node;
14   
15  use Twig\Compiler;
16   
17  /**
18   * Represents an if node.
19   *
20   * @author Fabien Potencier <fabien@symfony.com>
21   */
22  class IfNode extends Node
23  {
24      public function __construct(Node $tests, ?Node $else, int $lineno, string $tag = null)
25      {
26          $nodes = ['tests' => $tests];
27          if (null !== $else) {
28              $nodes['else'] = $else;
29          }
30   
31          parent::__construct($nodes, [], $lineno, $tag);
32      }
33   
34      public function compile(Compiler $compiler)
35      {
36          $compiler->addDebugInfo($this);
37          for ($i = 0, $count = \count($this->getNode('tests')); $i < $count; $i += 2) {
38              if ($i > 0) {
39                  $compiler
40                      ->outdent()
41                      ->write('} elseif (')
42                  ;
43              } else {
44                  $compiler
45                      ->write('if (')
46                  ;
47              }
48   
49              $compiler
50                  ->subcompile($this->getNode('tests')->getNode($i))
51                  ->raw(") {\n")
52                  ->indent()
53              ;
54              // The node might not exists if the content is empty
55              if ($this->getNode('tests')->hasNode($i + 1)) {
56                  $compiler->subcompile($this->getNode('tests')->getNode($i + 1));
57              }
58          }
59   
60          if ($this->hasNode('else')) {
61              $compiler
62                  ->outdent()
63                  ->write("} else {\n")
64                  ->indent()
65                  ->subcompile($this->getNode('else'))
66              ;
67          }
68   
69          $compiler
70              ->outdent()
71              ->write("}\n");
72      }
73  }
74   
75  class_alias('Twig\Node\IfNode', 'Twig_Node_If');
76