lithium\core\ObjectDeprecated::applyFilter()
Apply a closure to a method of the current object instance.
Parameters
-
mixed
$method
The name of the method to apply the closure to. Can either be a single method name as a string, or an array of method names. Can also be false to remove all filters on the current object.
-
\Closure
$filter
The closure that is used to filter the method(s), can also be false to remove all the current filters for the given method.
Returns
voidSource
public function applyFilter($method, $filter = null) {
$message = '`' . __METHOD__ . '()` has been deprecated in favor of ';
$message .= '`\lithium\aop\Filters::apply()` and `::clear()`.';
trigger_error($message, E_USER_DEPRECATED);
if ($method === false) {
Filters::clear($this);
return;
}
foreach ((array) $method as $m) {
if ($filter === false) {
Filters::clear($this, $m);
} else {
Filters::apply($this, $m, $filter);
}
}
}