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