Time2Configure

Interpolator

Allows to transform a simple value to a more complex operation.

An interpolator is associated to a configuration instance. It transforms automatically every entry value he can recognize to a compiled process wrapped in an Interpolation instance. This compilation is executed each time an interpolated value is accessed in a configuration.

For instance, there is a text interpolator implementation (Interpolators::recursive()) that can detect all '${key}' token element in a string value and makes a compilation that will substitutes each token by the $config['key'] value when the string is accessed.

Tags
template

V

template

I

author

Olivier Rodriguez (zuri)

Table of Contents

Methods

compile()  : Optional<string|int, mixed>
Compiles a value if possible
execute()  : I
Executes the compilation and return the result

Methods

compile()

Compiles a value if possible

public compile(V $value) : Optional<string|int, mixed>
Parameters
$value : V

The value to compile

Return values
Optional<string|int, mixed>

An optional filled by the compilation

execute()

Executes the compilation and return the result

public execute(mixed $compilation, Configuration<mixed, V$config) : I
Parameters
$compilation : mixed

The compilation to execute

$config : Configuration<mixed, V>

The configuration to consider

Return values
I

The result of the execution of the compilation


        
On this page

Search results