public function getFilter($name)
    {
        if (!$this->extensionInitialized) {
            $this->initExtensions();
        }

        if (isset($this->filters[$name])) {
            return $this->filters[$name];
        }

        foreach ($this->filters as $pattern => $filter) {
            $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count);

            if ($count) {
                if (preg_match('#^'.$pattern.'$#', $name, $matches)) {
                    array_shift($matches);
                    $filter->setArguments($matches);

                    return $filter;
                }
            }
        }

        foreach ($this->filterCallbacks as $callback) {
            if (false !== $filter = call_user_func($callback, $name)) {
                return $filter;
            }
        }

        return false;
    }
public function getFilter($name)
    {
        if (!$this->extensionInitialized) {
            $this->initExtensions();
        }

        if (isset($this->filters[$name])) {
            return $this->filters[$name];
        }

        foreach ($this->filters as $pattern => $filter) {
            $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count);

            if ($count) {
                if (preg_match('#^'.$pattern.'$#', $name, $matches)) {
                    array_shift($matches);
                    $filter->setArguments($matches);

                    return $filter;
                }
            }
        }

        foreach ($this->filterCallbacks as $callback) {
            if (false !== $filter = call_user_func($callback, $name)) {
                return $filter;
            }
        }

        return false;
    }
public function getFilter ( $ name ) { if ( ! $ this -> extensionInitialized ) { $ this -> initExtensions ( ) ; } if ( isset ( $ this -> filters [ $ name ] ) ) { return $ this -> filters [ $ name ] ; } foreach ( $ this -> filters as $ pattern => $ filter ) { $ pattern = str_replace ( '\\*' , '(.*?)' , preg_quote ( $ pattern , '#' ) , $ count ) ; if ( $ count ) { if ( preg_match ( '#^' . $ pattern . '$#' , $ name , $ matches ) ) { array_shift ( $ matches ) ; $ filter -> setArguments ( $ matches ) ; return $ filter ; } } } foreach ( $ this -> filterCallbacks as $ callback ) { if ( false !== $ filter = call_user_func ( $ callback , $ name ) ) { return $ filter ; } } return false ; }
Get a filter by name.

Subclasses may override this method and load filters differently;
so no list of filters is available.

@param string $name The filter name

@return Twig_Filter|false A Twig_Filter instance or false if the filter does not exist
Get a filter by name .