Makes sure that the event filter array is in the right format.

@param mixed $filters

@return array

@throws \InvalidArgumentException if not an array
493682
public function sanitizeEventFilter($filters)
    {
        if (!is_array($filters)) {
            throw new \InvalidArgumentException('filters parameter must be an array');
        }

        if (!isset($filters['search'])) {
            $filters['search'] = '';
        }

        if (!isset($filters['includeEvents'])) {
            $filters['includeEvents'] = [];
        }

        if (!isset($filters['excludeEvents'])) {
            $filters['excludeEvents'] = [];
        }

        return $filters;
    }
731620
public function withFilter($filter) {
        if (!in_array($filter, [self::ALL, self::ANY, self::SOME, self::EXISTS, self::NOT_EXISTS, self::IN, self::NOT_IN], true)) {
            throw new InvalidArgumentException('Invalid filter type for sub-query');
        }

        $this->_filter = $filter;

        return $this;
    }
1077708
public function where($filters, $values = null)
    {
        if ($filters === null) {
            return $this;
        }

        foreach (is_array($filters) ? $filters : [$filters => $values] as $filter => $value) {
            if (is_int($filter)) {
                $this->whereExpr($value);
            } elseif (is_array($value)) {
                if (preg_match('#([~@!<>|=%]+)$#', $filter, $match)) {
                    $operator = $match[1];
                    $field = substr($filter, 0, -strlen($operator));
                    if ($operator === '~=') {
                        if (count($value) !== 2) {
                            throw new MisuseException(['`value of :filter` filter is invalid', 'filter' => $filter]);
                        }
                        $this->whereBetween($field, $value[0], $value[1]);
                    } elseif ($operator === '@=') {
                        $this->whereDateBetween($field, $value[0], $value[1]);
                    } elseif ($operator === '|=') {
                        $this->_filters[] = [$field => ['$in' => $value]];
                    } elseif ($operator === '!=' || $operator === '<>') {
                        $this->whereNotIn($field, $value);
                    } elseif ($operator === '=') {
                        $this->whereIn($field, $value);
                    } elseif ($operator === '%=') {
                        $this->whereMod($field, $value[0], $value[1]);
                    } else {
                        throw new MisuseException(['unknown `:operator` operator', 'operator' => $operator]);
                    }
                } elseif (!$value || isset($value[0])) {
                    $this->whereIn($filter, $value);
                } else {
                    $this->_filters[] = [$filter => $value];
                }
            } elseif (preg_match('#^([\w\.]+)\s*([<>=!^$*~,@dm?]*)$#', $filter, $matches) === 1) {
                list(, $field, $operator) = $matches;

                if (strpos($operator, '?') !== false) {
                    $value = is_string($value) ? trim($value) : $value;
                    if ($value === '' || $value === null) {
                        continue;
                    }
                    $operator = substr($operator, 0, -1);
                }

                if ($operator === '') {
                    $operator = '=';
                }

                if (in_array($operator, ['=', '~=', '!=', '<>', '>', '>=', '<', '<='], true)) {
                    $this->whereCmp($field, $operator, $value);
                } elseif ($operator === '^=') {
                    $this->whereStartsWith($field, $value);
                } elseif ($operator === '$=') {
                    $this->whereEndsWith($field, $value);
                } elseif ($operator === '*=') {
                    $this->whereContains($field, $value);
                } elseif ($operator === ',=') {
                    $this->whereInset($field, $value);
                } elseif ($operator === '@d=') {
                    $this->whereDate($field, $value);
                } elseif ($operator === '@m=') {
                    $this->whereMonth($field, $value);
                } else {
                    throw new MisuseException(['unknown `:operator` operator', 'operator' => $operator]);
                }
            } elseif (strpos($filter, ',') !== false && preg_match('#^[\w,\.]+$#', $filter)) {
                $this->where1v1($filter, $value);
            } else {
                throw new InvalidValueException(['unknown mongodb query `filter` filter', 'filter' => $filter]);
            }
        }

        return $this;
    }
1318549
public function toArray(): array
    {
        if (!$this->hasParam('filter')) {
            throw new InvalidException('Filter is required');
        }

        $array = [
            'filter' => $this->getParam('filter')->toArray(),
        ];

        if ($this->_aggs) {
            $array['aggs'] = $this->_convertArrayable($this->_aggs);
        }

        return $array;
    }
729107
public function setFilters(array $filters): AbstractRepository
    {
        foreach ($filters as $f => $v) {
            $this->filterBy($f, $v);
        }

        return $this;
    }
1057618
public function getAll(array $filters = [])
    {
        $vars = $this->getEnvironmentVariables();

        foreach ($filters as $filter) {
            if (!$filter instanceof FilterInterface) {
                throw new FilterException(sprintf(
                    '%s %s %s',
                    'The $filters param must be an array',
                    'and your values must be an instance of',
                    '\Cekurte\Environment\Contract\FilterInterface'
                ));
            }

            $vars = $filter->filter($vars);
        }

        $callback = function ($rawValue) {
            return $this->getValue($rawValue);
        };

        return array_map($callback, $vars);
    }
692404
public function list(array $filters = [])
    {
        return self::$curl->get(self::$base_url.'?'.http_build_query(['filters' => json_encode($filters)]));
    }
697667
public function getAll($filter = null)
    {
        $filters = array('all', 'sales', 'purchase', 'inactive');
        if (!in_array($filter, $filters)) {
            $message = 'Unknown filter "' . $filter . '" for TaxRates';
            $message .= '; available filters: ' . implode(', ', $filters);
            throw new InvalidFilterException($message);
        }

        $rates = new ArrayObject;
        foreach ($this->connector->getAll(__NAMESPACE__) as $rate) {
            if (($filter == 'inactive' && $rate->active) || ($filter != 'inactive' && !$rate->active)) {
                continue;
            }
            if ($filter == 'sales' && $rate->taxRateType != TaxRate::RATE_TYPE_SALES) {
                continue;
            } elseif ($filter == 'purchase' && $rate->taxRateType != TaxRate::RATE_TYPE_PURCHASE) {
                continue;
            }
            $rates->append($rate);
        }
        return $rates;
    }
327249
public function whereSearch($filters)
    {
        foreach ($this->queries as $query) {
            $query->whereSearch($filters);
        }

        return $this;
    }
985283
public function getRecords($filters = array())
	{
		$entries = self::all();

		$c = $entries->getTableName();
		$e = '#__extensions';

		$entries
			->select($c . '.*,' . $e . '.name')
			->join($e, $e . '.element', $c . '.component', 'inner')
			->whereEquals($e . '.type', 'component');

		if (isset($filters['component']) && $filters['component'])
		{
			$entries->whereEquals($e . '.element', $filters['component']);
		}

		return $entries
			->ordered($c . '.component', 'asc')
			->rows();
	}
284714
public function setFilters($filters) {
		if ($filters instanceof Collection) {
			$filters = $filters->toArray();
		}
		
		$this->filters = $filters;

		return $this;
	}
500263
public function withFilters(array $filters = null)
    {
        if ($filters) {
            foreach ($filters as $filter) {
                switch ($filter['type']) {
                    case 'select':
                        $this->select($filter['fields']);
                        break;
                    case 'andWhere':
                        $this->andWhere($filter['field'], $filter['operation'], $filter['value']);
                        break;
                    case 'orWhere':
                        $this->orWhere($filter['field'], $filter['operation'], $filter['value']);
                        break;
                    case 'andHaving':
                        $this->andHaving($filter['field'], $filter['operation'], $filter['value']);
                        break;
                    case 'orHaving':
                        $this->orHaving($filter['field'], $filter['operation'], $filter['value']);
                        break;
                    case 'addGroupBy':
                        $this->addGroupBy($filter['field']);
                        break;
                    case 'addOrderBy':
                        $this->addOrderBy($filter['field'], $filter['order']);
                        break;
                    case 'fkAddOrderBy':
                        $this->fkAddOrderBy($filter['field'], $filter['fkField'], $filter['order']);
                        break;
                    case 'paginate':
                        if (isset($filter['page'])) {
                            $this->paginate($filter['limit'], $filter['page']);
                        } else {
                            $this->paginate($filter['limit']);
                        }
                        break;
                }
            }
        }

        return $this;
    }
402049
protected function parseRules(array $rules)
    {
        $parsedRules = [];

        foreach ($rules as $attribute => $filters) {
            if (empty($filters)) {
                throw new InvalidFilterException(
                    "The attribute [$attribute] must contain at least one filter."
                );
            }

            $this->parseAttributeFilters($parsedRules, $attribute, $filters);
        }

        return $parsedRules;
    }
765203
public static function all($filters) {
    return function ($node) use ($filters) {
      foreach ($filters as $filter) {
        if (!$filter($node)) {
          return FALSE;
        }
      }
      return TRUE;
    };
  }
414419
public function filters($filters)
    {
        if(!is_array($filters)){
            throw new \RuntimeException('Filters not specified', ResourceException::FILTERS_NOT_SPECIFIED);
        }

        $this->filters = json_encode($filters);

        return $this;
    }
322239
public function rawFilter($filters = [])
    {
        $filters = is_array($filters) ? $filters : func_get_args();

        foreach ($filters as $filter) {
            $this->filters['raw'][] = $filter;
        }

        return $this;
    }
1094087
public function setFilters($filters = [])
    {
        foreach ($filters as $field => $rules) {
            if ($field === 'fullSearch') {
                $this->addFilter($field, $rules, null);
                continue;
            }

            if (is_a($rules, MultiFullTextFilter::class)) {
                $this->addFilter($field, $rules, null);
                continue;
            }

            foreach ($rules as $operator => $value) {
                if (!in_array($operator, $this->availableFilters) || (empty($value) && $value != '0')) {
                    continue;
                }
                $this->addFilter($field, $value, $operator);
            }
        }

        return $this;
    }