Adds one or more filter objects to the filter collection.

@throws \Exception
181535
public function addFilters()
    {
        foreach (func_get_args() as $filter) {
            if (is_a($filter, 'Rhubarb\Stem\Filters\Filter')) {
                $this->filters[] = $filter;
            } else {
                throw new \Exception('Non filter object added to Group filter');
            }
        }
    }
97314
public function addFilter(Filter $filter)
    {
        $key = $filter->getKey();
        $this->filters[$key] = $filter;
    }
1078788
def add_filter(self, filter):
        
        if not isinstance(filter, AbstractFilter):
            err = 'Filters must be of type {}'.format(AbstractFilter)
            raise InvalidFilter(err)

        if filter not in self.filters:
            self.filters.append(filter)
        return self
831263
public static function addFilter($filter, $callback = null)
    {
        if (is_array($filter)) {
            $filters = $filter;
            foreach ($filters as $key => $filter) {
                if (is_numeric($key)) {
                    $key = $filter;
                }
                self::addFilter($key, $filter);
            }

            return true;
        } elseif (is_string($filter) && class_exists($filter, false) && is_subclass_of($filter, 'FilterCollection')) {
            foreach (get_class_methods($filter) as $f) {
                if (is_callable(array($filter, $f))) {
                    self::$filters[$f] = array($filter, $f);
                }
            }

            return true;
        }
        if (is_null($callback)) {
            $callback = $filter;
        }

        if (!is_callable($callback)) {
            return false;
        }
        self::$filters[$filter] = $callback;
    }
1230474
final private function parse_filters()
    {
        if (isset($this->filters) && \is_array($this->filters) && !empty($this->filters)) {
            $this->add_hooks($this->filters);
        }
    }
1333795
public function add($serializer)
    {
        if (!method_exists($serializer, 'serialize')) {
            throw new \Exception('The serializer '.get_class($serializer).' must implement the method serialize');
        }

        $this->serializers[] = $serializer;
    }
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 );
		} );
	}
1209254
public function filter($filter)
    {
        if (!is_a($filter, FilterBuilder::class)) {
            throw new \Exception ("Filter must be extend class 'FilterBuilder'");
        }

        $this->filter = $filter;

        return $this;
    }
938246
public function addFilter($filters)
    {

        $filters = is_array($filters) ? $filters : func_get_args();

        foreach ($filters as $filter) {

            $this->filters[] = $filter;
        }

        return $this;
    }
1180222
public function addFiltersWithAndToTable(iterable $filters): self
    {
        $addWith = $this->expr()->andX();
        $this->applyFilters($addWith, $this->getTableName(), $filters);
        $addWith->count() <= 0 ?: $this->andWhere($addWith);

        return $this;
    }
748159
public function addFilter(string $filterName, string $filterClassName) : void
    {
        $this->filters[$filterName] = $filterClassName;
    }
435311
public function setAllowFilters(array $filters = []): void
    {
        $this->allowFilters = [];
        foreach ($filters as $column) {
            $this->addAllowFilter($column);
        }
    }
742379
protected function initFilters()
    {
        if (!empty($this->filters)) {
            foreach ($this->filters as $name => $handler) {
                $this->addFilter($name, $handler);
            }
        }
    }
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;
    }
541264
public function initialize()
    {
        if (empty($this->columnFilters)) {
            return;
        }

        $this->validNumberOfFilters();

        foreach ($this->all() as $filter) {
            if ($filter instanceof Initializable) {
                $filter->initialize();
            }
        }

        $this->validNumberOfFilters();

        $filters = collect($this->columnFilters);

        if ($filters->last() === null) {
            $filters->pop();
            $filters->push(new Control());
        }

        $this->columnFilters = $filters;

        $this->prepareView();
    }
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;
    }
755233
protected function withFilter($filterName) {
        if(!isset($this->filters[$filterName])) {
            throw (new \Exception('Could not set filter '.$filterName.': filter not found'));
        }
        $this->activeFilters[] = $filterName;
        return $this;
    }