PHP Class LightnCandy\LightnCandy

Inheritance: extends Flags
Datei anzeigen Open project: zordius/lightncandy Class Usage Examples

Public Properties

Property Type Description
$lastParsed

Protected Properties

Property Type Description
$lastContext

Public Methods

Method Description
compile ( string $template, array\arraystring | integer> $options = ['flags' => self::FLAG_BESTPERFORMANCE] ) : string | false Compile handlebars template into PHP code.
compilePartial ( string $template, array\arraystring | integer> $options = ['flags' => self::FLAG_BESTPERFORMANCE] ) : string | false Compile handlebars partial into PHP function code.
getContext ( ) : array\arraystring | integer> Get last compiler context.
prepare ( string $php, string | null $tmpDir = null, boolean $delete = true ) : Closure | false Get a working render function by a string of PHP code. This method may requires php setting allow_url_include=1 and allow_url_fopen=1 , or access right to tmp file system.

Protected Methods

Method Description
handleError ( array\arraystring | integer> &$context ) : boolean Handle exists error and return error status.

Method Details

compile() public static method

Compile handlebars template into PHP code.
public static compile ( string $template, array\arraystring | integer> $options = ['flags' => self::FLAG_BESTPERFORMANCE] ) : string | false
$template string handlebars template string
$options array\arraystring | integer>
return string | false Compiled PHP code when successed. If error happened and compile failed, return false.

compilePartial() public static method

Compile handlebars partial into PHP function code.
public static compilePartial ( string $template, array\arraystring | integer> $options = ['flags' => self::FLAG_BESTPERFORMANCE] ) : string | false
$template string handlebars template string
$options array\arraystring | integer>
return string | false Compiled PHP code when successed. If error happened and compile failed, return false.

getContext() public static method

Get last compiler context.
public static getContext ( ) : array\arraystring | integer>
return array\arraystring | integer>

handleError() protected static method

Handle exists error and return error status.
protected static handleError ( array\arraystring | integer> &$context ) : boolean
$context array\arraystring | integer>
return boolean True when error detected

prepare() public static method

Get a working render function by a string of PHP code. This method may requires php setting allow_url_include=1 and allow_url_fopen=1 , or access right to tmp file system.
Deprecation:
public static prepare ( string $php, string | null $tmpDir = null, boolean $delete = true ) : Closure | false
$php string PHP code
$tmpDir string | null Optional, change temp directory for php include file saved by prepare() when cannot include PHP code with data:// format.
$delete boolean Optional, delete temp php file when set to tru. Default is true, set it to false for debug propose
return Closure | false result of include()

Property Details

$lastContext protected_oe static_oe property

protected static $lastContext

$lastParsed public_oe static_oe property

public static $lastParsed