@param array $filters

@return array

@throws \common_exception_Error
@throws \Exception
333989
private function prepareFilters(array $filters = [])
    {
        /** @var \common_session_Session $session */
        $session  = common_session_SessionManager::getSession();
        $timeZone = new DateTimeZone($session->getTimeZone());
        $utc      = new DateTimeZone('UTC');

        $result = [];

        foreach ($filters as $name => $value) {
            if (!empty($value)) {
                switch ($name) {
                    case 'from':
                        $from     = new DateTimeImmutable($filters['from'], $timeZone);
                        $result[] = ['occurred', '>', $from->setTimezone($utc)->format(DateTime::ISO8601)];
                        break;
                    case 'to':
                        $to       = new DateTimeImmutable($filters['to'], $timeZone);
                        $result[] = ['occurred', '<=', $to->setTimezone($utc)->format(DateTime::ISO8601)];
                        break;
                    default:
                        $result[] = [$name, 'LIKE', "%$value%"];
                }
            }
        }

        return $result;
    }
63636
public function all($filters = array())
	{
		$keys = eaccelerator_list_keys();

		$data = array();

		if (is_array($keys))
		{
			foreach ($keys as $key)
			{
				// Trim leading ":" to work around list_keys namespace bug in eAcc.
				// This will still work when bug is fixed.
				$key['name'] = ltrim($key['name'], ':');

				if (strpos($key['name'], $this->prefix) === 0)
				{
					continue;
				}

				$session = new Object;
				$session->session_id = $file->getName();
				$session->data       = (string) eaccelerator_get($key['name']);

				$data[] = $session;
			}
		}

		return $data;
	}
1256419
public function list(array $filters = [])
    {
        $data = [
            'filters' => json_encode($filters),
        ];

        $url = $this->url.'?'.http_build_query($data);

        return $this->curl->get($url);
    }
626488
public function getOptions($filters = null)
    {
        if (!$filters) {
            return $this->_parameters;
        }

        $result = [];

        foreach ($this->_parameters as $param) {
            $result[] = $this->filter($param, $filters);
        }

        return $result;
    }
386239
public function filter(array $filters)
	{
		foreach ($filters as $filter) {
			if ($filter->isValueSet()) {
				if ($filter->hasConditionCallback()) {
					$data = (array) call_user_func_array(
						$filter->getConditionCallback(),
						[$this->data, $filter->getValue()]
					);
					$this->setData($data);
				} else {
					$data = array_filter($this->data, function ($row) use ($filter) {
						return $this->applyFilter($row, $filter);
					});
					$this->setData($data);
				}
			}
		}

		return $this;
	}
271810
public function setFilters(array $filters)
    {
        if (empty($this->filters)) {
            $this->filters = $this->getDefaultFilters();
        }

        $this->filters = array_merge(
            $this->filters, $filters
        );

        return $this;
    }
71963
public function search(array $filters)
    {
        return $this->filter(function (CollectionableInterface $entity) use ($filters) {
            $res = true;
            foreach ($filters as $key => $value) {
                $current = $this->getPropertyAccessor()->getValue($entity, $key);
                $res = $res && (is_array($value) ?
                    in_array($current, $value) :
                    $current == $value
                );
            }

            return $res;
        });
    }
553033
public function filter(array $items, array $filters): array
    {
        if (empty($filters)) {
            // no filters means return all items
            return $items;
        }

        return array_filter($items, function ($item) use ($filters) {
            foreach ($filters as $filter) {
                $value = $this->extractValue($item, $filter->getField());
                if (!$this->valueMatchesFilter($value, $filter)) {
                    // all filters must pass so any failure means we
                    // can stop checking this item immediately.
                    return false;
                }
            }

            return true;
        });
    }
627552
protected static function explodeArrayFilters(array $filters)
	{
		$results = array();

		foreach ($filters as $filter)
		{
			$results = array_merge($results, explode('|', $filter));
		}

		return $results;
	}
599761
private function initFilters(array $filters)
    {
    	$result = array();
    
    	$fm = $this->getFilterManager();
    
    	foreach ($filters as $alias => $options) {
    		$option = null;
    		if (is_array($options)) {
    			if (!isset($options['name'])) {
    				throw new Exception\InvalidArgumentException(
    						'Filter "' . $alias . '" required option "name"'
    				);
    			}
    
    			$name = $options['name'];
    			$option = isset($options['option']) ? $options['option'] : null;
    		} elseif (is_string($options)) {
    			$name = $options;
    			unset($options);
    		}
    
    		if (is_numeric($alias)) {
    			$alias = $name;
    		}
    
    		// Filter Id should have optional filter indicator "?"
    		$filterId = ltrim($alias, '?');
    
    		if (!$fm->has($filterId)) {
    			if (is_array($option) && !empty($option)) {
    				$r = new \ReflectionClass($name);
    				$filter = $r->newInstanceArgs($option);
    			} else if ($option) {
    				$filter = new $name($option);
    			} else {
    				$filter = new $name();
    			}
    
    			$fm->set($filterId, $filter);
    		}
    
    		$result[] = $alias;
    	}
    
    	return $result;
    }
732004
public function addFilters(array $filters)
    {
        foreach ($filters as $key => $filter) {
            $this->addFilter($filter);

            /** Name the expression if $key is a non-numeric string. */
            if (is_string($key) && !is_numeric($key)) {
                $filter = end($this->filters);
                $filter->setName($key);
            }
        }

        return $this;
    }
110090
public function prune(array $filters = null)
    {
        $filters = self::checkPruneFilter($filters);

        $url = self::$base_url.'/prune?'.http_build_query(['filters' => $filters]);

        return self::$curl->post($url);
    }
1021721
private function getQueryFilter($filters)
    {
        $where = '';
        if (!empty($filters))
        {
            foreach ($filters as $filterKey => $filterValue)
            {
                $where .= ' AND m.' . $filterKey . ' LIKE :' . $filterKey;
            }
            $where = ' WHERE ' . substr($where, 4);
        }
        return $where;
    }
616254
public function makeTwigFilters($filters = [])
    {
        if (!is_array($filters)) {
            $filters = [];
        }

        foreach ($this->listFilters() as $name => $callable) {

            /*
             * Handle a wildcard function
             */
            if (strpos($name, '*') !== false && $this->isWildCallable($callable)) {
                $callable = function ($name) use ($callable) {
                    $arguments = array_slice(func_get_args(), 1);
                    $method = $this->isWildCallable($callable, Str::camel($name));
                    return call_user_func_array($method, $arguments);
                };
            }

            if (!is_callable($callable)) {
                throw new ApplicationException(sprintf('The markup filter for %s is not callable.', $name));
            }

            $filters[] = new Twig_SimpleFilter($name, $callable, ['is_safe' => ['html']]);
        }

        return $filters;
    }
1276671
private function resolveFilters(string $type, array $filters)
    {
        $filters_array_defined = 'filters_array_'.$type;

        $filters_array = [];

        try {
            $filters_array_defined = self::$$filters_array_defined;
        } catch (\Throwable $e) {
            throw new Exception($e->getMessage(), $e->getCode());
        }

        foreach ($filters as $k => $v) {
            if (!\in_array($k, $filters_array_defined, true)) {
                throw new Exception($filters, 500);
            }

            if (\is_array($v)) {
                $filters_array["$k"] = $v;

                continue;
            }

            $filters_array["$k"] = [$v];
        }

        return json_encode($filters_array);
    }
695951
private function filtersBooleanOverride(array $filters): array
    {
        foreach ($filters as $key => $filter) {
            $builderType = $filter['type'];

            switch ($builderType) {
                case 'boolean':
                    $filter['values'] = [
                        1 => 'Yes',
                        0 => 'No',
                    ];
                    $filter['input'] = 'radio';
                    $filter['colors'] = [
                        1 => 'success',
                        0 => 'danger',
                    ];

                    break;
            }

            $filters[$key] = $filter;
        }

        return $filters;
    }
470781
protected function parseFilters($filters)
    {
        $beforeFilter = array();
        $afterFilter = array();

        if (isset($filters[Route::BEFORE])) {
            $beforeFilter = array_intersect_key($this->filters, array_flip((array)$filters[Route::BEFORE]));
        }

        if (isset($filters[Route::AFTER])) {
            $afterFilter = array_intersect_key($this->filters, array_flip((array)$filters[Route::AFTER]));
        }

        return array($beforeFilter, $afterFilter);
    }