filters value with given filter

If value does not satisfy given filter return value will be null.

@param   \stubbles\input\Filter  $filter
@return  mixed
353087
private function applyFilter(Filter $filter)
    {
        list($filtered, $errors) = $filter->apply($this->value);
        if (count($errors) === 0) {
            return $filtered;
        }

        foreach ($errors as $error) {
            $this->paramErrors->append($this->paramName, $error);
        }

        return null;
    }
651497
public function hasQueryVals($filter = null)
    {
        // This should only work for GET request
        if (!$this->isGet()) {
            return false;
        }

        if ($filter !== null && $this->hasQuery($filter)) {
            $data = $this->getQuery($filter);
        } else {
            $data = $this->getQuery();
        }

        foreach ($data as $key => $value) {
            // If it's positive-like, then stop returning true
            if ($value == '0' || $value) {
                return true;
            }
        }

        // By default
        return false;
    }
1327833
public function getFilterValue($filterName)
    {
        if (isset($this->input['filters'][$filterName])) {
            return $this->input['filters'][$filterName];
        } else {
            return null;
        }
    }
435144
public function set_filter_values($filter, array $values = []) {
        $allvalues = (array) $this->get_config('filtervalues', []);
        $allvalues[$filter] = $values;

        return $this->set_config('filtervalues', $allvalues);
    }
1058686
public function checkByFilter(Filter $filter, Message $message)
    {
        return $this->check($filter->getCriteria(), $message);
    }
333220
public function findByFilter(Filter $filter, $limit = null, $offset = 0, $order = null)
    {
        return $this->findByCriteria($filter->getCriteria(), $limit, $offset, $order);
    }
644005
protected function convertToFilterFormat($filter)
    {
        $filter = trim($filter);
        if (substr($filter, 0, 1) != '(') {
            $filter = '(' . $filter;
        }
        if (substr($filter, -1) != ')') {
            $filter = $filter . ')';
        }
        return $filter;
    }
643528
public function getInputFilter($inputFilter = null)
    {
        $inputFilter        = $inputFilter ?? $this->inputFilter ?? $this->serviceAlias;
        $sl                 = $this->getServiceLocator();
        $inputFilterManager = $sl->get('InputFilterManager');
        $inputFilter        = $inputFilterManager->get($inputFilter);

        return $inputFilter;
    }
187175
public function setFilter($filter)
    {
        $this->userOptions['value']     = $this->getFilterValue($this->validator->arrayGet($filter, 'value', $this->getOption('value')));
        $this->userOptions['min_value'] = $this->getFilterValue($this->validator->arrayGet($filter, 'min_value', $this->getOption('min_value')));
        $this->userOptions['max_value'] = $this->getFilterValue($this->validator->arrayGet($filter, 'max_value', $this->getOption('max_value')));
    }
1290465
public function getParamsWithout($filter)
    {
        // Convert $filter to array if necessary
        if (!is_array($filter)) {
            $filter = preg_split("/, */", $filter, -1, PREG_SPLIT_NO_EMPTY);
        }

        $params = array_keys($this->getParams());
        $filter = array_merge(array_diff($params, $filter), array_diff($filter, $params));

        return $this->getParamsWith($filter);
    }
315296
public function setFilter(Filter $filter)
    {
        if (is_null($this->name)) {
            $this->name = $filter->getName();
        }
        $this->filter = $filter;

        return $this;
    }
759031
public function canFilter($canFilter = null)
    {
        if (null === $canFilter) {
            return $this->canFilter;
        }

        $this->canFilter = $canFilter;
        return $this;
    }
952642
private static function fixFilterFieldPath(?Filter $filter): ? Filter
    {
        if (is_null($filter)) {
            return $filter;
        }

        $filterAsArray = $filter->toArray();
        $filterAsArray['field'] = Item::getPathByField($filterAsArray['field']);

        return Filter::createFromArray($filterAsArray);
    }
776247
protected function get_filter_value($filtername, $default = null) {
        if ($values = $this->get_filter_values($filtername)) {
            $value = reset($values);
            return $value;
        }
        return $default;
    }
1336107
public function removeFilter(FilterInterface $filter)
    {

        $this->filters = array_filter($this->filters, function (FilterInterface $f) use ($filter) {

            return $f !== $filter;
        });

        return $this;
    }
223577
public function AddFilter( $filter )
	{
		$this->filters[] = $filter;

		if ( count( $this->filters ) <= 1 ) return;

		usort( $this->filters, function( /** @var Filter $a */ $a, /** @var Filter $b */ $b )
		{
			return $a->sortPriority > $b->sortPriority
				? 1
				: ( $a->sortPriority < $b->sortPriority ? -1 : 0 );
		} );
	}
1074350
public function getFilter($filtername) {
        $filter = null;
        if (!is_null($this->filters) && isset($this->filters[$filtername])) {
            $filter = $this->filters[$filtername];
        }
        return $filter;
    }