Compiler
in package
A class that offers some utility functions to require, parse, and compile view files.
Tags
Table of Contents
- compile() : string
- Compiles a PHP file with the passed variables.
- parse() : string
- Parses a file through the templating engine and returns a path to the compiled file.
- require() : void
- Requires a PHP file and pass it the passed variables.
- resolve() : string
- Resolves a file from the active theme or inherits it from a parent theme.
Methods
compile()
Compiles a PHP file with the passed variables.
public
static compile(string $file, string $type[, array<string|int, mixed>|null $variables = null ]) : string
Parameters
- $file : string
-
An absolute path to the file that should be compiled.
- $type : string
-
The type of the file (just a name to make for friendly exceptions).
- $variables : array<string|int, mixed>|null = null
Tags
Return values
string —parse()
Parses a file through the templating engine and returns a path to the compiled file.
public
static parse(string $file) : string
Parameters
- $file : string
-
The file to parse.
Return values
string —require()
Requires a PHP file and pass it the passed variables.
public
static require(string $file[, array<string|int, mixed>|null $variables = null ]) : void
Parameters
- $file : string
-
An absolute path to the file that should be compiled.
- $variables : array<string|int, mixed>|null = null
-
[optional] An associative array of the variables to pass.
Tags
Return values
void —resolve()
Resolves a file from the active theme or inherits it from a parent theme.
public
static resolve(string $file) : string
Parameters
- $file : string