lithium\util\collection\Filters::run()
Collects a set of filters to iterate. Creates a filter chain for the given class/method, executes it, and returns the value.
Parameters
-
mixed
$classThe class for which this filter chain is being created. If this is the result of a static method call,
$classshould be a string. Otherwise, it should be the instance of the object making the call. -
array
$paramsAn associative array of the given method's parameters.
-
array
$optionsThe configuration options with which to create the filter chain. Mainly, these options allow the
Filtersobject to be queried for details such as which class / method initiated it. Available keys:'class': The name of the class that initiated the filter chain.'method': The name of the method that initiated the filter chain.'data'array: An array of callable objects (usually closures) to be iterated through. By default, execution will be nested such that the first item will be executed first, and will be the last to return.
Returns
Returnsthe value returned by the first closure in $options['data]`.
Source
public static function run($class, $params, array $options = []) {
$message = '`\lithium\util\collection\Filters::run()` has been deprecated ';
$message .= 'in favor of `\lithium\aop\Filters::run()`';
trigger_error($message, E_USER_DEPRECATED);
$defaults = ['class' => null, 'method' => null, 'data' => []];
$options += $defaults;
$callback = array_pop($options['data']);
foreach ($options['data'] as $filter) {
NewFilters::apply($class, $options['method'], $filter);
}
return NewFilters::run($class, $options['method'], $params, $callback);
}