_filter() protected static method

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.
See also: lithium\util\collection\Filters
protected static _filter ( string $method, array $params, Closure $callback, array $filters = [] ) : mixed
$method string The name of the method being executed.
$params array An associative array containing all the parameters passed into the method.
$callback Closure The method's implementation, wrapped in a closure.
$filters array Additional filters to apply to the method for this call only.
return mixed
示例#1
0
 /**
  * Wraps `StaticObject::_filter()` to account for object instances.
  *
  * @see lithium\core\StaticObject::_filter()
  * @param string $method
  * @param array $params
  * @param mixed $callback
  * @param array $filters Defaults to empty array.
  * @return object
  */
 protected static function _filter($method, $params, $callback, $filters = array())
 {
     if (!strpos($method, '::')) {
         $method = get_called_class() . '::' . $method;
     }
     list($class, $method) = explode('::', $method, 2);
     $instance = static::_object();
     if (isset($instance->_instanceFilters[$method])) {
         $filters = array_merge($instance->_instanceFilters[$method], $filters);
     }
     return parent::_filter($method, $params, $callback, $filters);
 }