You are here

public function Twig_Compiler::compile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Compiler.php \Twig_Compiler::compile()

Compiles a node.

Parameters

Twig_NodeInterface $node The node to compile:

int $indentation The current indentation:

Return value

Twig_Compiler The current compiler instance

Overrides Twig_CompilerInterface::compile

File

vendor/twig/twig/lib/Twig/Compiler.php, line 72

Class

Twig_Compiler
Compiles a node to PHP code.

Code

public function compile(Twig_NodeInterface $node, $indentation = 0) {
  $this->lastLine = null;
  $this->source = '';
  $this->debugInfo = array();
  $this->sourceOffset = 0;

  // source code starts at 1 (as we then increment it when we encounter new lines)
  $this->sourceLine = 1;
  $this->indentation = $indentation;
  if ($node instanceof Twig_Node_Module) {
    $this->filename = $node
      ->getAttribute('filename');
  }
  $node
    ->compile($this);
  return $this;
}