lithium\core\ObjectDeprecated::_filter()
Executes a set of filters against a method by taking a method's main implementation as a
callback, and iteratively wrapping the filters around it. This, along with the Filters
class, is the core of Lithium's filters system. This system allows you to "reach into" an
object's methods which are marked as filterable, and intercept calls to those methods,
optionally modifying parameters or return values.
Parameters
-
string
$method
The name of the method being executed, usually the value of
__METHOD__
. -
array
$params
An associative array containing all the parameters passed into the method.
-
\Closure
$callback
The method's implementation, wrapped in a closure.
-
array
$filters
Additional filters to apply to the method for this call only.
Returns
mixedReturns the return value of $callback
, modified by any filters passed in
$filters
or applied with applyFilter()
.
Source
protected function _filter($method, $params, $callback, $filters = []) {
$message = '`' . __METHOD__ . '()` has been deprecated in favor of ';
$message .= '`\lithium\aop\Filters::run()` and `::apply()`.';
trigger_error($message, E_USER_DEPRECATED);
list(, $method) = explode('::', $method);
foreach ($filters as $filter) {
Filters::apply($this, $method, $filter);
}
return Filters::run($this, $method, $params, $callback);
}