40        @trigger_error(sprintf(
'The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
 
   75        $this->lastLine = 
null;
 
   77        $this->debugInfo = array();
 
   78        $this->sourceOffset = 0;
 
   80        $this->sourceLine = 1;
 
   82        $this->varNameSalt = 0;
 
   86            $this->filename = $node->getTemplateName();
 
   97            $this->source .= str_repeat(
' ', $this->indentation * 4);
 
  112    public function raw($string)
 
  114        $this->source .= $string;
 
  126        $strings = func_get_args();
 
  127        foreach ($strings as $string) {
 
  128            $this->source .= str_repeat(
' ', $this->indentation * 4).$string;
 
  143        @trigger_error(
'The '.__METHOD__.
' method is deprecated since version 1.27 and will be removed in 2.0. Use write(\'\') instead.', E_USER_DEPRECATED);
 
  145        $this->source .= str_repeat(
' ', $this->indentation * 4);
 
  159        $this->source .= sprintf(
'"%s"', addcslashes($value, 
"\0\t\"\$\\"));
 
  173        if (is_int($value) || is_float($value)) {
 
  174            if (
false !== $locale = setlocale(LC_NUMERIC, 
'0')) {
 
  175                setlocale(LC_NUMERIC, 
'C');
 
  180            if (
false !== $locale) {
 
  181                setlocale(LC_NUMERIC, $locale);
 
  183        } elseif (
null === $value) {
 
  185        } elseif (is_bool($value)) {
 
  186            $this->
raw($value ? 
'true' : 
'false');
 
  187        } elseif (is_array($value)) {
 
  188            $this->
raw(
'array(');
 
  190            foreach ($value as 
$key => $v) {
 
  214        if ($node->getTemplateLine() != $this->lastLine) {
 
  215            $this->
write(sprintf(
"// line %d\n", $node->getTemplateLine()));
 
  220            if (((
int) ini_get(
'mbstring.func_overload')) & 2) {
 
  221                @trigger_error(
'Support for having "mbstring.func_overload" different from 0 is deprecated version 1.29 and will be removed in 2.0.', E_USER_DEPRECATED);
 
  224                $this->sourceLine += mb_substr_count(mb_substr($this->source, $this->sourceOffset), 
"\n");
 
  226                $this->sourceLine += substr_count($this->source, 
"\n", $this->sourceOffset);
 
  228            $this->sourceOffset = strlen($this->source);
 
  231            $this->lastLine = $node->getTemplateLine();
 
  239        ksort($this->debugInfo);
 
  253        $this->indentation += 
$step;
 
  270        if ($this->indentation < 
$step) {
 
  271            throw new LogicException(
'Unable to call outdent() as the indentation would become negative.');
 
  274        $this->indentation -= 
$step;
 
  281        return sprintf(
'__internal_%s', 
hash(
'sha256', __METHOD__.$this->varNameSalt++));
 
  285class_alias(
'Twig_Compiler', 
'Twig\Compiler', 
false);
 
  286class_exists(
'Twig_Node');
 
An exception for terminatinating execution or to throw for unit testing.
Compiles a node to PHP code.
raw($string)
Adds a raw string to the compiled code.
addDebugInfo(Twig_NodeInterface $node)
Adds debugging information.
compile(Twig_NodeInterface $node, $indentation=0)
Compiles a node.
string($value)
Adds a quoted string to the compiled code.
getEnvironment()
Returns the environment instance related to this compiler.
getSource()
Gets the current PHP code after compilation.
indent($step=1)
Indents the generated code.
outdent($step=1)
Outdents the generated code.
subcompile(Twig_NodeInterface $node, $raw=true)
write()
Writes a string to the compiled code by adding indentation.
__construct(Twig_Environment $env)
repr($value)
Returns a PHP representation of a given value.
addIndentation()
Appends an indentation to the current PHP code after compilation.
Stores the Twig configuration.
Represents a module node.
foreach($_REQUEST as $var) foreach(array('_POST'=> 'HTTP_POST_VARS', '_GET'=> 'HTTP_GET_VARS', '_COOKIE'=> 'HTTP_COOKIE_VARS', '_SERVER'=> 'HTTP_SERVER_VARS', '_ENV'=> 'HTTP_ENV_VARS', '_FILES'=> 'HTTP_POST_FILES') as $array=> $other) $step
Interface implemented by compiler classes.
Represents a node in the AST.
compile(Twig_Compiler $compiler)
Compiles the node to PHP.
hash(StreamInterface $stream, $algo, $rawOutput=false)
Calculate a hash of a Stream.