Attempt to instantiate the filter if it exists and has not been ignored.

@return null|\Assetic\Filter\FilterInterface
496678
public function getInstance()
    {
        if ( ! $class = $this->getClassName())
        {
            $this->log->error(sprintf('"%s" will not be applied to asset "%s" due to an invalid filter name.', $this->filter, $this->resource->getRelativePath()));
        }

        if ($this->ignored or is_null($class) or ! $this->processRequirements()) return;

        // If the class returned is already implements Assetic\Filter\FilterInterface then
        // we can set the instance directly and not worry about using reflection.
        if ($class instanceof FilterInterface)
        {
            $instance = $class;
        }
        else
        {
            $reflection = new ReflectionClass($class);

            // If no constructor is available on the filters class then we'll instantiate
            // the filter without passing in any arguments.
            if ( ! $reflection->getConstructor())
            {
                $instance = $reflection->newInstance();
            }
            else
            {
                $instance = $reflection->newInstanceArgs($this->arguments);
            }
        }

        // Spin through each of the before filtering callbacks and fire each one. We'll
        // pass in an instance of the filter to the callback.
        foreach ($this->before as $callback)
        {
            if (is_callable($callback))
            {
                call_user_func($callback, $instance);
            }
        }

        return $instance;
    }
96843
protected function initFilters()
    {
        // If override status is set in field options to true
        // we will change filtersOverride property value to true
        // so we can override existing filters with registered
        // alias/name in addFilter method.
        $overrideStatus = $this->getOption('filters_override', false);
        if ($overrideStatus) {
            $this->setFiltersOverride(true);
        }

        // Get filters and bind it to field.
        $filters = $this->getOption('filters', []);
        foreach ($filters as $filter) {
            $this->addFilter($filter);
        }

        return $this;
    }
1074273
public function init()
    {
        parent::init();

        $this->visible = Yii::$app->user->can('access-subclients');
        if (!$this->visible) {
            return null;
        }

        if (!$this->sortAttribute) {
            $this->sortAttribute = $this->nameAttribute;
        }
        if ($this->value === null) {
            $this->value = function ($model) {
                if (Yii::$app->user->identity->hasSeller($model->{$this->idAttribute})) {
                    return $model->{$this->nameAttribute};
                } else {
                    return Html::a($model->{$this->nameAttribute}, ['@client/view', 'id' => $model->{$this->idAttribute}]);
                }
            };
        }
        if (!empty($this->grid->filterModel)) {
            if (!isset($this->filterInputOptions['id'])) {
                $this->filterInputOptions['id'] = $this->attribute;
            }
            if ($this->filter === null && strpos($this->attribute, '_like') === false) {
                $this->filter = $this->getDefaultFilter();
            }
        }

        return true;
    }
808297
public function setFilter($filter = null)
    {
        $this->filter = is_callable($filter) ? $filter : null;

        return $this;
    }
11945
protected function getFilter() {
		$filter = $this->getOption('query.filter');
		$negate = false;
		if ($this->hasOption('query.negate'))
			$negate = (bool) $this->getOption('query.negate');
		if (is_array($filter))
			return new Filter($filter, $negate);
		return new Filter([$filter], $negate);
	}
336671
public function addFilter($filter)
    {
        if (!$filter instanceof FilterInterface) {
            if (!is_callable($filter)) {
                throw new \InvalidArgumentException('Filter should be callable or ' . FilterInterface::class);
            }

            $filter = new CallbackFilter($filter);
        }

        $this->filters[] = $filter;

        return $this;
    }
1111774
public function toProto()
    {
        if ($this->trueFilter === null && $this->falseFilter === null) {
            throw new \RuntimeException(
                sprintf(
                    'In order to utilize a condition filter you must supply a filter through either %s:%s or %s:%s.',
                    self::class,
                    'then()',
                    self::class,
                    'otherwise()'
                )
            );
        }
        $condition = (new Condition)
            ->setPredicateFilter($this->predicateFilter);
        if ($this->trueFilter) {
            $condition->setTrueFilter($this->trueFilter);
        }
        if ($this->falseFilter) {
            $condition->setFalseFilter($this->falseFilter);
        }
        return (new RowFilter)
            ->setCondition($condition);
    }
703958
public function getFilter()
    {
        if ($this->filter) {
            return $this->filter;
        }

        $filterType = $this->getFilterType();

        if (!$filterType) {
            return false;
        }

        if (class_exists($filterType)) {
            $className = $filterType;
        } else {
            $className = str_replace('_', ' ', $filterType);
            $className = ucwords(strtolower($className));
            $className = str_replace(' ', '', $className);

            $className = 'PedroTeixeira\Bundle\GridBundle\Grid\Filter\\' . $className;
        }

        try {
            $reflection = new \ReflectionClass($className);

            $this->filter = $reflection->newInstance(
                $this->container
            );

            $this->filter->setIndex($this->getIndex());

            return $this->filter;

        } catch (\Exception $e) {
            throw new \Exception(
                sprintf('Grid column type "%s" doesn\'t exist', $filterType)
            );
        }
    }
1034298
public function search(SearchCondition\SearchConditionInterface $filter, SelectOrder\SelectOrderInterface $order = null)
	{
		if ( ! ($filter instanceof SearchCondition\ArraySearchCondition)) {
			throw new Exception\WrongInstance($filter, 'SearchCondition\ArraySearchCondition');
		}
		$filterClosure = $filter->getSearchClosure();

		$orderClosure = null;
		if ( ! \is_null($order)) {
			if ( ! ($order instanceof SelectOrder\ArraySelectOrder)) {
				throw new Exception\WrongInstance($order, 'SelectOrder\ArraySelectOrder');
			}
			$orderClosure = $order->getOrderClosure();
		}

		$result = $this->searchByClosure($filterClosure, $orderClosure);
		
		return $result;
	}
1139915
public function buildFilters()
	{
		$this->setFilterMapper(new FilterMapper);
		$this->configureFilters($this->getFilterMapper());

		$this->setFilterBuilder(new FilterBuilder($this->getFilterMapper()));
		$this->getFilterBuilder()
			->build();

		return $this;
	}
979136
public static function instance() {
        global $CFG;
        if (is_null(self::$singletoninstance)) {
            if (!empty($CFG->perfdebug) and $CFG->perfdebug > 7) {
                self::$singletoninstance = new performance_measuring_filter_manager();
            } else {
                self::$singletoninstance = new self();
            }
        }
        return self::$singletoninstance;
    }
1031202
private function applyFilters()
    {
        $layer      = $this->layerResolver->get();
        $filterList = $this->getFilterList();

        foreach ($filterList->getFilters($layer) as $filter) {
            $filter->apply($this->getRequest());
        }

        $layer->apply();

        return $this;
    }
317833
private function getFilter(string $filterId): ?FilterInterface
    {
        if ($this->filterLocator instanceof ContainerInterface && $this->filterLocator->has($filterId)) {
            return $this->filterLocator->get($filterId);
        }

        if ($this->filterLocator instanceof FilterCollection && $this->filterLocator->offsetExists($filterId)) {
            return $this->filterLocator->offsetGet($filterId);
        }

        return null;
    }
226701
public function initialize()
    {
        static::addFilterDefinition('required', array($this, 'filterRequired'));
        static::addFilterDefinition('string', array($this, 'filterString'));
        static::addFilterDefinition('boolean', array($this, 'filterBoolean'));
        static::addFilterDefinition('confirm', array($this, 'filterConfirm'));
        static::addFilterDefinition('validate_regexp', array($this, 'filterValidateRegexp'));
        static::addFilterDefinition('validate_url', array($this, 'filterValidateUrl'));
        static::addFilterDefinition('validate_date', array($this, 'filterValidateDate'));
        static::addFilterDefinition('php', array($this, 'filterPHP'));
        static::addFilterDefinition('max_length', array($this, 'filterMaxLength'));
        static::addFilterDefinition('min_length', array($this, 'filterMinLength'));
        static::$isInitialized = TRUE;
    }
662086
public function getFilterCollection(): FilterCollection
    {
        if ($this->filters === null) {
            $this->filters = new FilterCollection();
        }
        return $this->filters;
    }
62560
public static function create($filter)
    {
        if (array_key_exists($filter, static::$filters)) {
            $class = static::$filters[$filter];
        } else if (
        is_subclass_of($filter, 'Slick\Filter\FilterInterface')
        ) {
            $class = $filter;
        } else {
            throw new Exception\UnknownFilterClassException(
                "The filter '{$filter}' is not defined or does not " .
                "implements the Slick\\Filter\\FilterInterface interface"
            );
        }

        return new $class();
    }
381075
public function getFilteredValue()
    {
        if ($this->hasFilterer()) {
            $value = $this->getFilterer()->filter($this->getValue());
        } else {
            $value = $this->getValue();
        }

        return $value;
    }