Compiler
in package
Compiles a node to PHP code.
Tags
Table of Contents
- $debugInfo : mixed
- $env : mixed
- $indentation : mixed
- $lastLine : mixed
- $source : mixed
- $sourceLine : mixed
- $sourceOffset : mixed
- $varNameSalt : mixed
- __construct() : mixed
- addDebugInfo() : $this
- Adds debugging information.
- compile() : $this
- Compiles a node.
- getDebugInfo() : mixed
- getEnvironment() : Environment
- Returns the environment instance related to this compiler.
- getSource() : string
- Gets the current PHP code after compilation.
- getVarName() : mixed
- indent() : $this
- Indents the generated code.
- outdent() : $this
- Outdents the generated code.
- raw() : $this
- Adds a raw string to the compiled code.
- repr() : $this
- Returns a PHP representation of a given value.
- string() : $this
- Adds a quoted string to the compiled code.
- subcompile() : mixed
- write() : $this
- Writes a string to the compiled code by adding indentation.
Properties
$debugInfo
private
mixed
$debugInfo
= []
$env
private
mixed
$env
$indentation
private
mixed
$indentation
$lastLine
private
mixed
$lastLine
$source
private
mixed
$source
$sourceLine
private
mixed
$sourceLine
$sourceOffset
private
mixed
$sourceOffset
$varNameSalt
private
mixed
$varNameSalt
= 0
Methods
__construct()
public
__construct(Environment $env) : mixed
Parameters
- $env : Environment
Return values
mixed —addDebugInfo()
Adds debugging information.
public
addDebugInfo(Node $node) : $this
Parameters
- $node : Node
Return values
$this —compile()
Compiles a node.
public
compile(Node $node, int $indentation) : $this
Parameters
- $node : Node
- $indentation : int
-
The current indentation
Return values
$this —getDebugInfo()
public
getDebugInfo() : mixed
Return values
mixed —getEnvironment()
Returns the environment instance related to this compiler.
public
getEnvironment() : Environment
Return values
Environment —getSource()
Gets the current PHP code after compilation.
public
getSource() : string
Return values
string —The PHP code
getVarName()
public
getVarName() : mixed
Return values
mixed —indent()
Indents the generated code.
public
indent([int $step = 1 ]) : $this
Parameters
- $step : int = 1
-
The number of indentation to add
Return values
$this —outdent()
Outdents the generated code.
public
outdent([int $step = 1 ]) : $this
Parameters
- $step : int = 1
-
The number of indentation to remove
Tags
Return values
$this —raw()
Adds a raw string to the compiled code.
public
raw(string $string) : $this
Parameters
- $string : string
-
The string
Return values
$this —repr()
Returns a PHP representation of a given value.
public
repr(mixed $value) : $this
Parameters
- $value : mixed
-
The value to convert
Return values
$this —string()
Adds a quoted string to the compiled code.
public
string(string $value) : $this
Parameters
- $value : string
-
The string
Return values
$this —subcompile()
public
subcompile(Node $node[, mixed $raw = true ]) : mixed
Parameters
- $node : Node
- $raw : mixed = true
Return values
mixed —write()
Writes a string to the compiled code by adding indentation.
public
write(mixed ...$strings) : $this
Parameters
- $strings : mixed