Przeglądaj źródła

[TwigBundle] removed obsolete code

Fabien Potencier 14 lat temu
rodzic
commit
55e6883a88

+ 0 - 4
src/Symfony/Bundle/TwigBundle/Extension/TemplatingExtension.php

@@ -12,7 +12,6 @@
 namespace Symfony\Bundle\TwigBundle\Extension;
 
 use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Bundle\TwigBundle\TokenParser\IncludeTokenParser;
 use Symfony\Bundle\TwigBundle\TokenParser\RenderTokenParser;
 
 /**
@@ -98,9 +97,6 @@ class TemplatingExtension extends \Twig_Extension
         return array(
             // {% render 'BlogBundle:Post:list' with { 'limit': 2 }, { 'alt': 'BlogBundle:Post:error' } %}
             new RenderTokenParser(),
-
-            // {% include 'sometemplate.php' with { 'something' : 'something2' } %}
-            new IncludeTokenParser(),
         );
     }
 

+ 0 - 53
src/Symfony/Bundle/TwigBundle/Node/HelperNode.php

@@ -1,53 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Bundle\TwigBundle\Node;
-
-/**
- *
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-class HelperNode extends \Twig_Node
-{
-    public function __construct($helper, $method, \Twig_Node_Expression_Array $values, $lineno, $tag = null)
-    {
-        parent::__construct(array('values' => $values), array('helper' => $helper, 'method' => $method), $lineno, $tag);
-    }
-
-    /**
-     * Compiles the node to PHP.
-     *
-     * @param \Twig_Compiler A Twig_Compiler instance
-     */
-    public function compile(\Twig_Compiler $compiler)
-    {
-        $compiler
-            ->addDebugInfo($this)
-            ->raw("\$this->env->getExtension(")
-            ->string('templating')
-            ->raw(")->getContainer()->get(")
-            ->string($this->getAttribute('helper'))
-            ->raw(")->")
-            ->raw($this->getAttribute('method'))
-            ->raw("(")
-        ;
-
-        foreach ($this->getNode('values') as $i => $value) {
-            $compiler->subcompile($value);
-            if ($i !== count($this->getNode('values')) - 1) {
-                $compiler->raw(', ');
-            }
-        }
-
-        $compiler->raw(")");
-    }
-}

+ 0 - 83
src/Symfony/Bundle/TwigBundle/Node/IncludeNode.php

@@ -1,83 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Bundle\TwigBundle\Node;
-
-/**
- * Represents an include node.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-class IncludeNode extends \Twig_Node
-{
-    public function __construct(\Twig_Node_Expression $expr, \Twig_Node_Expression $variables = null, $only = false, $lineno, $tag = null)
-    {
-        parent::__construct(array('expr' => $expr, 'variables' => $variables), array('only' => (Boolean) $only), $lineno, $tag);
-    }
-
-    /**
-     * Compiles the node to PHP.
-     *
-     * @param \Twig_Compiler A Twig_Compiler instance
-     */
-    public function compile(\Twig_Compiler $compiler)
-    {
-        // template
-        $compiler
-            ->addDebugInfo($this)
-            ->write("\$template = ")
-            ->subcompile($this->getNode('expr'))
-            ->raw(";\n")
-            ->write("if (\$template instanceof Twig_Template) {\n")
-            ->indent()
-        ;
-
-        // template is a Twig_Template instance
-        $compiler->write("\$template->display(");
-        $this->compileTemplateVariables($compiler);
-        $compiler
-            ->raw(");\n")
-            ->outdent()
-            ->write("} else {\n")
-            ->indent()
-        ;
-
-        // else use the templating engine
-        $compiler->write("echo \$this->env->getExtension('templating')->getTemplating()->render(\$template, ");
-        $this->compileTemplateVariables($compiler);
-        $compiler
-            ->raw(");\n")
-            ->outdent()
-            ->write("}\n")
-        ;
-    }
-
-    protected function compileTemplateVariables($compiler)
-    {
-        if (false === $this->getAttribute('only')) {
-            if (null === $this->getNode('variables')) {
-                $compiler->raw('$context');
-            } else {
-                $compiler
-                    ->raw('array_merge($context, ')
-                    ->subcompile($this->getNode('variables'))
-                    ->raw(')')
-                ;
-            }
-        } else {
-            if (null === $this->getNode('variables')) {
-                $compiler->raw('array()');
-            } else {
-                $compiler->subcompile($this->getNode('variables'));
-            }
-        }
-    }
-}