src/Filter/Filters.php
public static function run($context, $method, $params, $callback, $filters = [])
    {
        if (static::$_enabled) {
            $filters = array_merge($filters, static::filters($context, $method));
        }
        $filters[] = $callback;
        $generator = static::_generator($filters);

        $next = function () use ($params, $generator, &$next) {
            $args = func_get_args() + $params;
            $closure = $generator->current();
            $generator->next();
            array_unshift($args, $next);
            return call_user_func_array($closure, $args);
        };
        return call_user_func_array($next, $params);
    }
public static function run($context, $method, $params, $callback, $filters = [])
    {
        if (static::$_enabled) {
            $filters = array_merge($filters, static::filters($context, $method));
        }
        $filters[] = $callback;
        $generator = static::_generator($filters);

        $next = function () use ($params, $generator, &$next) {
            $args = func_get_args() + $params;
            $closure = $generator->current();
            $generator->next();
            array_unshift($args, $next);
            return call_user_func_array($closure, $args);
        };
        return call_user_func_array($next, $params);
    }
public static function run ( $ context , $ method , $ params , $ callback , $ filters = [ ] ) { if ( static :: $ _enabled ) { $ filters = array_merge ( $ filters , static :: filters ( $ context , $ method ) ) ; } $ filters [ ] = $ callback ; $ generator = static :: _generator ( $ filters ) ; $ next = function ( ) use ( $ params , $ generator , & $ next ) { $ args = func_get_args ( ) + $ params ; $ closure = $ generator -> current ( ) ; $ generator -> next ( ) ; array_unshift ( $ args , $ next ) ; return call_user_func_array ( $ closure , $ args ) ; } ; return call_user_func_array ( $ next , $ params ) ; }
Cuts the normal execution of a method to run all applied filter for the method.

@param  mixed   $context  An instance or a fully-namespaced class name to run filters on.
@param  string  $method   The method name.
@param  array   $params   The parameters the pass to the original method.
@param  Closure $callback The original method closure.
@param  array   $filters  Additional filters to apply on this run.
@return mixed
Cuts the normal execution of a method to run all applied filter for the method .