src/Filter/Filters.php
public static function apply($context, $method, $filter)
    {
        static::$_cachedFilters = [];

        if (is_object($context)) {
            $instance = $context;
            $class = get_class($context);
        } else {
            $class = $context;
            $instance = null;
        }

        $filter = $filter->bindTo($instance, $class);

        $ref = static::_ref($context, $method);
        if (!isset(static::$_filters[$ref])) {
            static::$_filters[$ref] = [$filter];
        } else {
            array_unshift(static::$_filters[$ref], $filter);
        }
        return $ref . '|' . (count(static::$_filters[$ref]) - 1);
    }
public static function apply($context, $method, $filter)
    {
        static::$_cachedFilters = [];

        if (is_object($context)) {
            $instance = $context;
            $class = get_class($context);
        } else {
            $class = $context;
            $instance = null;
        }

        $filter = $filter->bindTo($instance, $class);

        $ref = static::_ref($context, $method);
        if (!isset(static::$_filters[$ref])) {
            static::$_filters[$ref] = [$filter];
        } else {
            array_unshift(static::$_filters[$ref], $filter);
        }
        return $ref . '|' . (count(static::$_filters[$ref]) - 1);
    }
public static function apply ( $ context , $ method , $ filter ) { static :: $ _cachedFilters = [ ] ; if ( is_object ( $ context ) ) { $ instance = $ context ; $ class = get_class ( $ context ) ; } else { $ class = $ context ; $ instance = null ; } $ filter = $ filter -> bindTo ( $ instance , $ class ) ; $ ref = static :: _ref ( $ context , $ method ) ; if ( ! isset ( static :: $ _filters [ $ ref ] ) ) { static :: $ _filters [ $ ref ] = [ $ filter ] ; } else { array_unshift ( static :: $ _filters [ $ ref ] , $ filter ) ; } return $ ref . '|' . ( count ( static :: $ _filters [ $ ref ] ) - 1 ) ; }
Applies a filter.

@param  mixed  $context An instance or a fully-namespaced class name.
@param  string $method  A method name.
@param  string $filter  The filter to apply.
@return string          The filter id.

@throws InvalidArgumentException
Applies a filter .