Gets a filter instance from grid. If filter not set, then creating an empty filter instance.

@return Filter
325937
public function getFilter()
    {
        if (null == $this->filter) {
            $this->filter = new Filter([
                'serviceLocator' => $this->getServiceLocator(),
                'id'             => $this->getId(),
            ]);
        }

        return $this->filter;
    }
808297
public function setFilter($filter = null)
    {
        $this->filter = is_callable($filter) ? $filter : null;

        return $this;
    }
824279
protected function makeFilter()
    {
        $data = new ModelFilterData($this->getModelInformation(), $this->filters);

        return new ModelFilter($this->getModelInformation(), $data);
    }
73945
protected function filter()
	{
		foreach ($this->filters as $attribute => $filters) {
			// Check if the attribute is present in the input data
			if (!array_key_exists($attribute, $this->data)) {
				continue;
			}

			$data = $this->data[$attribute];

			foreach ($filters as $filter) {
				// The format for specifying filter and parameters follows an
				// easy {filter}:{parameters} formatting convention.
				if (strpos($filter, ':') !== false) {
					list($filter, $parameterList) = explode(':', $filter, 2);
					$parameters = explode(',', $parameterList);
				} else {
					$parameters = [];
				}
				
				if (method_exists($this, $this->camelCase($filter))) {
					$data = $this->filterWalker($filter, $data, $parameters);
				} elseif (isset($this->extensions[$filter])) {
					$data = $this->filterExtensionWalker($filter, $data, $parameters);
				} else {
					throw new \Exception("'$filter' is not a valid filter.");
				}
			}

			$this->filteredData[$attribute] = $data;
		}

		return $this->filteredData;
	}
979136
public static function instance() {
        global $CFG;
        if (is_null(self::$singletoninstance)) {
            if (!empty($CFG->perfdebug) and $CFG->perfdebug > 7) {
                self::$singletoninstance = new performance_measuring_filter_manager();
            } else {
                self::$singletoninstance = new self();
            }
        }
        return self::$singletoninstance;
    }
391281
public function getOperator()
    {
        if ($this->operator) {
            return $this->operator;
        }

        $operatorType = $this->getOperatorType();

        if (!$operatorType) {
            return false;
        }

        $className = str_replace('_', ' ', $operatorType);
        $className = ucwords(strtolower($className));
        $className = str_replace(' ', '', $className);

        try {
            $reflection = new \ReflectionClass('PedroTeixeira\Bundle\GridBundle\Grid\Filter\Operator\\' . $className);

            $this->operator = $reflection->newInstance(
                $this->container
            );

            $this->operator->setIndex($this->getIndex());

            return $this->operator;
        } catch (\Exception $e) {
            throw new \Exception(
                sprintf('Filter operator type "%s" doesn\'t exist', $operatorType)
            );
        }
    }
662086
public function getFilterCollection(): FilterCollection
    {
        if ($this->filters === null) {
            $this->filters = new FilterCollection();
        }
        return $this->filters;
    }
1304745
protected function getSearchFilter()
    {
        $pattern = $this->getRequest()->getQuery('pattern', null);
        $pattern = StaticFilter::filter('text', $pattern);
        $this->set('pattern', $pattern);
        
        return new SearchFilter(['pattern' => $pattern]);
    }
365006
public function getFilter($filter)
    {
        $result = null;

        if(isset($this->__filters[$filter])) {
            $result = $this->__filters[$filter];
         }

        return $result;
    }
1046495
public static function &GetInstanceForCurrentFilter()
    {
        static $oInstance = false;
        if (false === $oInstance) {
            $oInstance = null;
            $aFilter = TdbShop::GetActiveFilter();
            if (array_key_exists('shop_manufacturer_id', $aFilter) && !empty($aFilter['shop_manufacturer_id'])) {
                $oInstance = TdbShopManufacturer::GetNewInstance();
                /** @var $oInstance TdbShopManufacturer */
                if (!$oInstance->Load($aFilter['shop_manufacturer_id'])) {
                    $oInstance = null;
                }
            }
        }

        return $oInstance;
    }
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;
    }
636388
public function getFilters()
    {
        if (is_array($this->filters)) {
            return $this->filters;
        }

        $request = $this->getRequest();
        $toolbarFilters = $request->getPost('toolbarFilters', $request->getQuery('toolbarFilters'));
        $filters = [];
        if (($request->isPost() === true || $request->isGet() === true) &&
            null !== $toolbarFilters
        ) {
            foreach ($toolbarFilters as $uniqueId => $value) {
                if ($value != '') {
                    foreach ($this->getColumns() as $column) {
                        /* @var $column \ZfcDatagrid\Column\AbstractColumn */
                        if ($column->getUniqueId() == $uniqueId) {
                            $filter = new \ZfcDatagrid\Filter();
                            $filter->setFromColumn($column, $value);

                            $filters[] = $filter;

                            $column->setFilterActive($filter->getDisplayColumnValue());
                        }
                    }
                }
            }
        }

        if (! empty($filters)) {
            $this->filters = $filters;
        } else {
            // No user sorting -> get default sorting
            $this->filters = $this->getFiltersDefault();
        }

        return $this->filters;
    }
1187758
protected function GetCurrentFilter()
    {
        static $aFilter = 'x';
        if ('x' == $aFilter) {
            $oShop = TdbShop::GetInstance();
            $aFilter = $oShop->GetActiveFilter();
        }

        return $aFilter;
    }
739166
public function getFilter($name)
    {
        $filter = null;
        if(isset($this->_filters[$name])) {
            $filter = $this->_filters[$name];
        }

        return $filter;
    }
366074
protected function getSearchFilter()
    {
        if ($this->searchFilterCache) {
            return $this->searchFilterCache;
        }

        // Check for given FilterClass
        $params = $this->getRequest()->getVar('q');
        if (empty($params['FilterClass'])) {
            return null;
        }

        // Validate classname
        $filterClass = $params['FilterClass'];
        $filterInfo = new ReflectionClass($filterClass);
        if (!$filterInfo->implementsInterface(LeftAndMain_SearchFilter::class)) {
            throw new InvalidArgumentException(sprintf('Invalid filter class passed: %s', $filterClass));
        }

        return $this->searchFilterCache = Injector::inst()->createWithArgs($filterClass, array($params));
    }
1166091
public function getServices($filter = null)
	{
		$services = array();

		// Create the request
		$request = new client\Request('/api/mpegts/service/grid');

		if ($filter)
			$request->setFilter($filter);

		// Get the response
		$response = $this->_client->getResponse($request);
		$rawContent = $response->getContent();

		$content = json_decode($rawContent);

		foreach ($content->entries as $entry)
			$services[] = model\Service::fromRawEntry($entry);

		return $services;
	}
1187040
protected function getTemplate()
    {
        $filter_tpl = $this->config->getTemplate();
        $grid_tpl = $this->grid->getConfig()->getTemplate();
        return str_replace('*.', "$grid_tpl.filters.", $filter_tpl);
    }