Validates if filter exists and is valid

@param  string                             $filter Filter Service
@throws Exception\FilterNotFoundException
@throws Exception\InvalidArgumentException
@return void
356401
protected function validateFilter($filter)
    {
        if (!isset($this->filterOptions->getFilters()[$filter])) {
            throw new Exception\FilterNotFoundException(sprintf(
                'Filter "%s" was not found', $filter
            ));
        }
        $options = $this->filterOptions->getFilters()[$filter];
        if (!isset($options['type'])) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Filter type for "%s" image filter must be specified', $filter
            ));
        }
        if (!isset($options['options'])) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Options for filter type "%s" must be specified', $filter
            ));
        }
    }
471447
public function applyFilterDate(Filter\FilterDate $filter)
	{
		$p1 = $this->getPlaceholder();
		$p2 = $this->getPlaceholder();

		foreach ($filter->getCondition() as $column => $value) {
			try {
				$date = DateTimeHelper::tryConvertToDateTime($value, [$filter->getPhpFormat()]);
				$c = $this->checkAliases($column);

				$this->data_source->andWhere("$c >= :$p1 AND $c <= :$p2")
					->setParameter($p1, $date->format('Y-m-d 00:00:00'))
					->setParameter($p2, $date->format('Y-m-d 23:59:59'));
			} catch (DataGridDateTimeHelperException $ex) {
				// ignore the invalid filter value
			}
		}
	}
184988
public function invalidateResourceIndex(FilterInterface $filter = null)
    {
        $this->cache->deleteItem($this->getResourceIndexKey($filter));
    }
1012283
public function filter($filter = null)
    {
        if (is_null($filter)) {
            return $this->filter;
        } else {
            $this->filter = $filter;
        }
    }
808297
public function setFilter($filter = null)
    {
        $this->filter = is_callable($filter) ? $filter : null;

        return $this;
    }
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;
    }
830728
public static function validateDatetimeIso8601($data, callable $filter=null) {
        if ( DateTime::createFromFormat(DateTime::ATOM, $data) === false ) return false;
        return self::applyFilter($data, $filter);
    }
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;
    }
743849
public function filter($filter = 'image.filters.default')
    {
        $filters = (array) $this->get($filter, []);
        foreach ($filters as $params) {
            $params = (array) $params;
            $method = array_shift($params);
            $this->__call($method, $params);
        }
    }
283203
private static function validateFilters($filters, $settings)
    {
        if (!is_array($filters)) {
            $filters = [$filters];
        }

        // Each fitler.
        foreach ($filters as $index => &$filter) {

            // Check this item.
            $filter = self::validateFilterItem($filter, $settings);

            // Remove if invalid.
            if (empty($filter)) {
                unset($filters[$index]);
            }
        }

        return $filters;
    }
1127106
protected function filter($value, $filter)
    {
        if (null !== $filter) {
            $value = Filter::_($value, $filter);
        }

        return $value;
    }
255194
public function setFilter($name, $filter)
    {
        if (!(
            is_callable($filter) ||
            class_exists($filter) ||
            method_exists($filter, 'parse')
        )) {
            throw new InvalidArgumentException(
                'Invalid ' . $name . ' filter given: ' .
                'it must be a callable or a class name.'
            );
        }

        return $this->getCompiler()->setFilter($name, $filter);
    }
638376
protected function validateFilters()
  {
    if (!empty($this->value) && !empty($this->filters)) {
      foreach ($this->filters as $filter) {
        if (is_array($this->value) && $this->isMultipleChoiceAllowed()) {
          $this->value = Filter::Arr($this->value, $filter, null);

          $bad = empty($this->value);
        } else {
          $bad = is_null(Filter::Value($this->value, $filter, null));
        }

        if ($bad) {
          $this->addError(sprintf($this->tmpl_err_wrong, $this->getName()));

          return false;
        }
      }
    }

    return true;
  }
136534
private function filterPrefixer(array &$filter)
    {
        foreach ($filter as &$child) {
            if (\array_key_exists('property', $child)
                && (false === \strpos($child['property'], $this->source . '.'))
                && $this->fieldExists($child['property'])
            ) {
                $child['property'] = $this->source . '.' . $child['property'];
            }

            if (\array_key_exists('children', $child)) {
                $this->filterPrefixer($child['children']);
            }
        }
    }
18969
public function addFilter($filter)
    {
        if (!($filter instanceof FilterInterface) && !is_callable($filter)) {
            $filter = FilterHelper::create($filter);
        }

        $this->filter->addFilter($filter);

        return $this;
    }
792511
public static function validateFloat($data, callable $filter=null) {
        if ( is_float($data) === false ) return false;
        return self::applyFilter($data, $filter);
    }
286655
protected function setFilter($filter, AssetInterface $asset)
    {
        if (is_null($filter)) {
            return;
        }

        if (!empty($filter['filter'])) {
            $this->ensureByFilter($asset, $filter['filter']);

            return;
        }

        if (!empty($filter['service'])) {
            $this->ensureByService($asset, $filter['service']);

            return;
        }

        throw new Exception\RuntimeException(
            'Invalid filter supplied. Expected Filter or Service.'
        );
    }