]> Raphaël G. Git Repositories - packbundle/commitdiff
Cleanup
authorRaphaël Gertz <git@rapsys.eu>
Tue, 26 Nov 2019 12:34:47 +0000 (13:34 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Tue, 26 Nov 2019 12:34:47 +0000 (13:34 +0100)
Twig/PackNode.php

index 4f08be031e8f34e02a4bf744d566b47867475d5c..79e8e41105222615455de2a7a3717c5417ec44b8 100644 (file)
@@ -1,25 +1,15 @@
 <?php
-// src/Rapsys/PackBundle/Twig/PackTokenParser.php
-namespace Rapsys\PackBundle\Twig;
-
-class PackNode extends \Twig_Node {
-       #public function __construct($name, $value, $line, $tag = null) {
-       #       parent::__construct(array('value' => $value), array('name' => $name), $line, $tag);
-       #}
-       public function __construct(array $nodes = array(), array $attributes = array(), $lineno = 0, $tag = null) {
-               parent::__construct($nodes, $attributes, $lineno, $tag);
-               #$this->output = $attributes['output'];
-               #$this->setAttribute($this->getAttribute('name'), $attributes['name']);
-       }
 
-       public function compile(\Twig_Compiler $compiler) {
+namespace Rapsys\PackBundle\Twig;
 
-               #header('Content-Type: text/plain');
-               #var_dump($this->getNode(0));
-               #var_dump($this->attributes);
-               #var_dump($compiler->subcompile($this->getNode(0)));
-               #exit;
-               #$compiler->addDebugInfo($this)->write('echo \'<pre>'.json_encode(array('nodes' => $this->nodes, 'attributes' => $this->attributes)).'</pre>\';');
+class PackNode extends \Twig\Node\Node {
+       /**
+        * Compile the body node
+        *
+        * @param $compiler
+        */
+       public function compile(\Twig\Compiler $compiler) {
+               //Add $context['<name>'] = '<value>'; in twig template
                $compiler
                        ->addDebugInfo($this)
                        ->write('$context[\''.$this->getAttribute('name').'\'] = ')