Process a query filter with the current model.

@param  FilterInterface $filter The expression object.
@return FilterInterface The parsed expression object.
550473
protected function parseFilterWithModel(FilterInterface $filter)
    {
        if ($this->hasModel()) {
            if ($filter->hasProperty()) {
                $model    = $this->model();
                $property = $filter->property();
                if (is_string($property) && $model->hasProperty($property)) {
                    $property = $model->property($property);

                    if ($property->l10n()) {
                        $filter->setProperty($property->l10nIdent());
                    }

                    if ($property->multiple()) {
                        $filter->setOperator('FIND_IN_SET');
                    }
                }
            }

            if ($filter instanceof FilterCollectionInterface) {
                $filter->traverseFilters(function (FilterInterface $expr) {
                    $this->parseFilterWithModel($expr);
                });
            }
        }

        return $filter;
    }
867460
public function addFilter(FilterInterface $filter)
    {
        if ($this->containsFilter($filter)) {
            throw new CollectionException(sprintf(
                'Collection already contains key "%s".', $filter->getName()
            ));
        }

        $this->add($filter);

        return $this;
    }
979244
public function add($filter)
    {
        if (is_array($filter)) {
            $this->collection[] = new Filter($filter);
        } elseif (is_object($filter) && $filter instanceof Filter) {
            $this->collection[] = $filter;
        }

        return $this;
    }
1154389
protected function prepareFilter(array $filter)
    {
        foreach ($filter as $code => &$value) {
            if ($code === 'id') {
                intval($value);

                if ($value <= 0) {
                    throw new ArgumentNullException($code);
                }
            } elseif ($code === 'base') {

                if (!is_bool($value)) {
                    throw new ArgumentNullException($code);
                }

            } else {
                trim(htmlspecialchars($value));

                if (strlen($value) <= 0) {
                    throw new ArgumentNullException($code);
                }
            }
        }

        return $filter;
    }
732805
public function provideFilter($filter = null)
    {
        if ($filter === null) {
            $filter = config('eloquentfilter.namespace', 'App\\ModelFilters\\').class_basename($this).'Filter';
        }

        return $filter;
    }
1303239
protected function setFilter(string $filter)
    {
        $user = $this->getBackendUser();
        $validFilter = ['all', 'cached', 'notCached'];
        if ('' === $filter) {
            $filter = (string)$user->getSessionData('sfc_filter');
        }
        if (!\in_array($filter, $validFilter, true)) {
            $filter = 'all';
        } else {
            $user->setAndSaveSessionData('sfc_filter', $filter);
        }

        return $filter;
    }
1317458
public function where(callable $filter)
    {
        $filtered = [];

        foreach ($this->array as $key => $value) {
            if ($filter($key, $value) === true) {
                $filtered[$key] = $value;
            }
        }

        return $filtered;
    }
435996
public function addFilter(FilterInterface $filter)
    {
        if ($this->hasFilter($filter->getName())) {
            throw new FilterAlreadyExistsException($filter->getName());
        }

        $this->filters[$filter->getName()] = $filter;
    }
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;
    }
1180644
public function addFilter($filter)
    {
        // Resolve filter object from string/object or throw Ex.
        $filterObj = FilterResolver::instance($filter);

        // If filtersOverride is allowed we will override filter
        // with same alias/name if there is one with new resolved filter.
        if ($this->getFiltersOverride()) {
            if ($key = array_search($filterObj->getName(), $this->getFilters())) {
                $this->filters[$key] = $filterObj;
            } else {
                $this->filters[$filterObj->getName()] = $filterObj;
            }
        } else {
            // If filtersOverride is disabled and we found
            // equal alias defined we will throw Ex.
            if (array_key_exists($filterObj->getName(), $this->getFilters())) {
                $ex = new FilterAlreadyBindedException($filterObj->getName(), $this->getName());
                throw $ex;
            }

            // Filter with resolvedFilter alias/name doesn't exist
            // so we will bind it as new one to field.
            $this->filters[$filterObj->getName()] = $filterObj;
        }

        return $this;
    }
606587
public function getEAVAttributes(FilterInterface $filter): array
    {
        return $this->filterHelper->getEAVAttributes($this->getFamily(), $filter->getAttributes());
    }
345929
public function removeByFilter($filter)
    {
        foreach ($this->where($filter) as $item) {
            $this->remove($item);
        }
        return $this;
    }
1368110
private function addFilter($filter)
    {
        if (is_array($filter)) {
            if (!isset($filter['method'])) {
                throw new \InvalidArgumentException(
                    'A [method] value must be specified for each complex filter'
                );
            }
        }

        if (!$this->filters) {
            $this->filters = [$filter];
        } else {
            $this->filters[] = $filter;
        }

        return $this;
    }
341118
public function applyFilter($qb, FilterInterface $filter, QueryObjectInterface $queryObject)
    {
        if ($queryObject instanceof FilterableQueryObjectInterface) {
            $filterMap = $queryObject->getFilterMap();

            /* @var $filterRule FilterRule */
            foreach ($filter as $filterRule) {
                // rule must be bound
                if (!$filterRule->isBound()) {
                    continue;
                }

                // rule must be present in the filter map
                if (!isset($filterMap[$filterRule->getName()])) {
                    throw new \InvalidArgumentException(\sprintf(
                        'Column "%s" is not present in the filter map',
                        $filterRule->getName()
                    ));
                }

                $this->filterRuleProcessor->process($qb, $filterRule, $filterMap[$filterRule->getName()]);
            }
        }
    }
425292
public function filter($filter): ArrayObjectInterface
    {
        return \is_callable($filter, true) ? $this->filterCallback($filter) : $this->filterConditions($filter);
    }
1120823
public function remove($filter)
    {
        $index = $this->indexOf($filter);

        if ($index > -1) {
            $this->offsetUnset($index);
        }

        return $this;
    }
822990
public function process(Aoe_ExtendedFilter_Model_Interface $filter, array $params)
    {
        // Re-parse the third parameter with the parameter tokenizer and discard original parameters
        $params = $filter->getIncludeParameters($params[2]);

        // Grab the store
        $storeId = $filter->getStoreId();

        // Pull out expected parameters
        $path = (isset($params['path']) ? $params['path'] : '');
        $modifiers = (isset($params['modifiers']) ? $params['modifiers'] : '');

        // Lookup config
        $value = '';
        if (!empty($path)) {
            $value = Mage::getStoreConfig($path, $storeId);
        }

        // If we have modifiers, process now
        if (!empty($modifiers)) {
            $value = $filter->amplifyModifiers($value, $modifiers);
        }

        return $value;
    }