PHP Class XPSPL\SIG\complex\Func

Allows for performing complex signal processing using \\Closures and callable PHP variables provided in the construct. A \\Closure can be rebound into the Func object context on construct which allows maintaining variables across emits. This object was created for use in the API.
Inheritance: extends XPSPL\SIG_Complex
Show file Open project: prggmr/xpspl

Protected Properties

Property Type Description
$_function callable Function to evaluate the emitting signal.

Public Methods

Method Description
__construct ( callable $function, boolean $rebind_context = false ) Construct
evaluate ( string | integer $signal = null ) : boolean Evaluates the emitted signal by calling the $_evaluate_func function.

Method Details

__construct() public method

Constructs a Func object. Allows for rebinding a \\Closure to the Func object context for maintaining variables across emits.
public __construct ( callable $function, boolean $rebind_context = false )
$function callable Callable variable to use for evaluation.
$rebind_context boolean Rebind the given closures context to this object.

evaluate() public method

Evaluates the emitted signal by calling the $_evaluate_func function.
public evaluate ( string | integer $signal = null ) : boolean
$signal string | integer Signal to evaluate
return boolean

Property Details

$_function protected property

Function to evaluate the emitting signal.
protected callable $_function
return callable