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

DumpNode.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 2.73 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\Node;
13   
14  use Twig\Compiler;
15  use Twig\Node\Node;
16   
17  /**
18   * @author Julien Galenski <julien.galenski@gmail.com>
19   */
20  class DumpNode extends Node
21  {
22      private $varPrefix;
23   
24      public function __construct($varPrefix, Node $values = null, $lineno, $tag = null)
25      {
26          $nodes = [];
27          if (null !== $values) {
28              $nodes['values'] = $values;
29          }
30   
31          parent::__construct($nodes, [], $lineno, $tag);
32          $this->varPrefix = $varPrefix;
33      }
34   
35      /**
36       * {@inheritdoc}
37       */
38      public function compile(Compiler $compiler)
39      {
40          $compiler
41              ->write("if (\$this->env->isDebug()) {\n")
42              ->indent();
43   
44          if (!$this->hasNode('values')) {
45              // remove embedded templates (macros) from the context
46              $compiler
47                  ->write(sprintf('$%svars = [];'."\n", $this->varPrefix))
48                  ->write(sprintf('foreach ($context as $%1$skey => $%1$sval) {'."\n", $this->varPrefix))
49                  ->indent()
50                  ->write(sprintf('if (!$%sval instanceof \Twig\Template) {'."\n", $this->varPrefix))
51                  ->indent()
52                  ->write(sprintf('$%1$svars[$%1$skey] = $%1$sval;'."\n", $this->varPrefix))
53                  ->outdent()
54                  ->write("}\n")
55                  ->outdent()
56                  ->write("}\n")
57                  ->addDebugInfo($this)
58                  ->write(sprintf('\Symfony\Component\VarDumper\VarDumper::dump($%svars);'."\n", $this->varPrefix));
59          } elseif (($values = $this->getNode('values')) && 1 === $values->count()) {
60              $compiler
61                  ->addDebugInfo($this)
62                  ->write('\Symfony\Component\VarDumper\VarDumper::dump(')
63                  ->subcompile($values->getNode(0))
64                  ->raw(");\n");
65          } else {
66              $compiler
67                  ->addDebugInfo($this)
68                  ->write('\Symfony\Component\VarDumper\VarDumper::dump(['."\n")
69                  ->indent();
70              foreach ($values as $node) {
71                  $compiler->write('');
72                  if ($node->hasAttribute('name')) {
73                      $compiler
74                          ->string($node->getAttribute('name'))
75                          ->raw(' => ');
76                  }
77                  $compiler
78                      ->subcompile($node)
79                      ->raw(",\n");
80              }
81              $compiler
82                  ->outdent()
83                  ->write("]);\n");
84          }
85   
86          $compiler
87              ->outdent()
88              ->write("}\n");
89      }
90  }
91