PHP Class LiquidContext, php-liquid

Show file Open project: harrydeluxe/php-liquid Class Usage Examples

Public Properties

Property Type Description
$environments array Global scopes
$registers array Registers for non-variable state data

Public Methods

Method Description
__construct ( array $assigns = null, array $registers = [] ) Constructor
addFilters ( mixed $filter ) Add a filter to the context
fetch ( string $key ) : mixed Fetches the current key in all the scopes
get ( $key ) : mixed Replaces []
hasKey ( string $key ) : boolean Returns true if the given key will properly resolve
invoke ( string $name, mixed $value, array $args = null ) : string Invoke the filter that matches given name
merge ( array $newAssigns ) Merges the given assigns into the current assigns
pop ( ) : boolean Pops the current scope from the stack.
push ( ) : boolean Push new local scope on the stack.
resolve ( string $key ) : mixed Resolve a key by either returning the appropriate literal or by looking up the appropriate variable
set ( string $key, mixed $value, boolean $global = false ) Replaces []=
variable ( string $key ) : mixed Resolved the namespaced queries gracefully.

Method Details

__construct() public method

Constructor
public __construct ( array $assigns = null, array $registers = [] )
$assigns array
$registers array

addFilters() public method

Add a filter to the context
public addFilters ( mixed $filter )
$filter mixed

fetch() public method

Fetches the current key in all the scopes
public fetch ( string $key ) : mixed
$key string
return mixed

get() public method

Replaces []
public get ( $key ) : mixed
return mixed

hasKey() public method

Returns true if the given key will properly resolve
public hasKey ( string $key ) : boolean
$key string
return boolean

invoke() public method

Invoke the filter that matches given name
public invoke ( string $name, mixed $value, array $args = null ) : string
$name string The name of the filter
$value mixed The value to filter
$args array Additional arguments for the filter
return string

merge() public method

Merges the given assigns into the current assigns
public merge ( array $newAssigns )
$newAssigns array

pop() public method

Pops the current scope from the stack.
public pop ( ) : boolean
return boolean

push() public method

Push new local scope on the stack.
public push ( ) : boolean
return boolean

resolve() public method

Test for empty has been moved to interpret condition, in LiquidDecisionBlock
public resolve ( string $key ) : mixed
$key string
return mixed

set() public method

Replaces []=
public set ( string $key, mixed $value, boolean $global = false )
$key string
$value mixed
$global boolean

variable() public method

Resolved the namespaced queries gracefully.
public variable ( string $key ) : mixed
$key string
return mixed

Property Details

$environments public property

Global scopes
public array $environments
return array

$registers public property

Registers for non-variable state data
public array $registers
return array