Get the events filter.
@param string $filter Filter

@return EventsFilter
332946
protected function getUserEventsFilter(string $filter = null)
    {
        $mappingConfiguration = new PropertyMappingConfiguration();

        return $this->convertEventsFilter($mappingConfiguration, $filter);
    }
1176035
protected function getUserAnnouncementsFilter(string $filter = null)
    {
        $mappingConfiguration = new PropertyMappingConfiguration();
        return $this->convertAnnouncementsFilter($mappingConfiguration, $filter);
    }
273350
private function buildRequiredOwnerFilter(GetFilterEvent $event, $filter)
    {
        $connection = $event->getConnection();
        $platform = $connection->getDatabasePlatform();
        $targetEntity = $event->getTargetEntity();
        $targetTableAlias = $event->getTargetTableAlias();

        $identifier = DoctrineUtils::castIdentifier($targetEntity, $connection);
        $ownerId = $event->getRealParameter('user_id');
        $ownerColumn = $this->getAssociationColumnName($targetEntity, 'owner');
        $ownerFilter = null !== $ownerId
            ? "{$targetTableAlias}.{$ownerColumn}{$identifier} = {$connection->quote($ownerId)}"
            : "{$platform->getIsNullExpression($targetTableAlias.'.'.$ownerColumn)}";

        return <<<SELECTCLAUSE
{$ownerFilter}
    OR
({$filter})
SELECTCLAUSE;
    }
18969
public function addFilter($filter)
    {
        if (!($filter instanceof FilterInterface) && !is_callable($filter)) {
            $filter = FilterHelper::create($filter);
        }

        $this->filter->addFilter($filter);

        return $this;
    }
495551
public static function convertFilter($filter)
    {
        if (!$filter) {
            return array();
        }
        if (is_array($filter)) {
            return $filter;
        }

        $filter_array = array();
        $rules        = explode('|', $filter);
        foreach ($rules as $rule) {
            list($name, $arg) = self::get_name_and_arg($rule);
            $filter_array[$name] = $arg;
        }

        return $filter_array;
    }
726541
public function get($filter)
    {
        if (false === \array_key_exists($filter, $this->filters)) {
            throw new NonExistingFilterException(sprintf('Could not find configuration for a filter: %s', $filter));
        }

        return $this->filters[$filter];
    }
49453
public function withFilter(Filter $filter)
    {
        if ($this->value->isNull()) {
            return null;
        }

        return $this->applyFilter($filter);
    }
737165
protected function getPredicatesFromFilterCondition($filter)
    {
        $predicates = [];
        $regex = "/(^|\b)(\w+\:\w+)\.(l|u)(\b|$)/";
        foreach($filter as $key=>$condition)
        {
            if(is_string($key))
            {
                $numMatches = preg_match_all($regex, $key, $matches);
                for($i = 0; $i < $numMatches; $i++)
                {
                    if(isset($matches[2][$i]))
                    {
                        $predicates[] = $matches[2][$i];
                    }
                }
            }
            if(is_string($condition))
            {
                $numMatches = preg_match_all($regex, $condition, $matches);
                for($i = 0; $i < $numMatches; $i++)
                {
                    if(isset($matches[2][$i]))
                    {
                        $predicates[] = $matches[2][$i];
                    }
                }
            }
            elseif(is_array($condition))
            {
                array_merge($predicates, $this->getPredicatesFromFilterCondition($condition));
            }
        }
        return $predicates;
    }
336671
public function addFilter($filter)
    {
        if (!$filter instanceof FilterInterface) {
            if (!is_callable($filter)) {
                throw new \InvalidArgumentException('Filter should be callable or ' . FilterInterface::class);
            }

            $filter = new CallbackFilter($filter);
        }

        $this->filters[] = $filter;

        return $this;
    }
466451
public function getFilter($filter)
    {
        //Create the complete identifier if a partial identifier was passed
        if (is_string($filter) && strpos($filter, '.') === false) {
            $identifier = clone $this->getIdentifier();
            $identifier->path = array('template', 'filter');
            $identifier->name = $filter;
        } else {
            $identifier = AnService::getIdentifier($filter);
        }

        if (!isset($this->_filters[$filter])) {
            register_default(array(
                'identifier' => $identifier,
                'prefix' => $this
            ));
            
            $filter = AnService::get($identifier);

            if (!($filter instanceof LibBaseTemplateFilterInterface)) {
                throw new LibBaseTemplateException("Template filter $identifier does not implement LibBaseTemplateFilterInterface");
            }
        } else {
            $filter = $this->_filters[$identifier->name];
        }

        return $filter;
    }
582243
public function fireFilter(string $event, $filter, array $arguments = null) {
        $arguments = (array)$arguments;

        array_unshift($arguments, $filter);
        $filter = &$arguments[0];

        foreach ($this->getBindings($event) as $callback) {
            if (is_callable($callback)) {
                $arguments[0] = call_user_func_array($callback, $arguments);
            }
        }

        return $filter;
    }
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;
    }
425292
public function filter($filter): ArrayObjectInterface
    {
        return \is_callable($filter, true) ? $this->filterCallback($filter) : $this->filterConditions($filter);
    }
639645
public function getFilter(GetFilterEvent $event): void
    {
        $filter = $this->buildSharingFilter($event);
        $filter = $this->buildOwnerFilter($event, $filter);

        $event->setFilterConstraint($filter);
    }
102749
protected function callFilter($filter, $request, $response = null)
	{
		return $this->events->until('router.'.$filter, array($request, $response));
	}
1329361
public function findEventsByAssociation($association, $eventsFilter = null)
    {
        $xmlQuery = $this->associationsApiService->getEventsFromAssociation($association->getID(), $eventsFilter);

        $events = new Events();

        $mapper = new \RGU\Dvoconnector\Mapper\Events($xmlQuery);
        $mapper->mapToAbstractEntity($events);

        return $this->completeEntity($events);
    }
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;
    }