Twig_Node_Import

Represents an import node.

Defined (1)

The class is defined in the following location(s).

/vendor/twig/twig/lib/Twig/Node/Import.php  
  1. class Twig_Node_Import extends Twig_Node 
  2. public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $var, $lineno, $tag = null) 
  3. parent::__construct(array('expr' => $expr, 'var' => $var), array(), $lineno, $tag); 
  4.  
  5. public function compile(Twig_Compiler $compiler) 
  6. $compiler 
  7. ->addDebugInfo($this) 
  8. ->write('') 
  9. ->subcompile($this->getNode('var')) 
  10. ->raw(' = ') 
  11.  
  12. if ($this->getNode('expr') instanceof Twig_Node_Expression_Name && '_self' === $this->getNode('expr')->getAttribute('name')) { 
  13. $compiler->raw('$this'); 
  14. } else { 
  15. $compiler 
  16. ->raw('$this->loadTemplate(') 
  17. ->subcompile($this->getNode('expr')) 
  18. ->raw(', ') 
  19. ->repr($this->getTemplateName()) 
  20. ->raw(', ') 
  21. ->repr($this->getTemplateLine()) 
  22. ->raw(')') 
  23.  
  24. $compiler->raw(";\n");