lithium\aop\Chain::run()
Runs the chain causing any queued callables and finally the implementation to be executed.
Before each run the implementation is made available to
Chain::__invoke()
and the chain rewinded, after each run the
implementation is unset.
An example implementation which is bound to an instance receives exactly one argument (the named parameters).
function($params) {
$foo = $this->_bar;
return $foo . 'baz';
}
Parameters
-
array
$params
An array of named parameters.
-
callable
$implementation
Returns
mixedThe end result of the chain.
Source
public function run(array $params, $implementation) {
$this->_implementation = $implementation;
$filter = reset($this->_filters);
$result = $filter($params, $this);
$this->_implementation = null;
return $result;
}