@param $filter

@return array
182705
protected function filterContainsZip($filter)
    {
        $return = [];

        if (
            (isset($filter->string) && preg_match('/^\d{5}(?:[-\s]\d{4})?$/', $filter->string))
            || false !== strpos(serialize($filter), 'zipcode')
        ) {
            $return = ['l.zipcode'];
        }

        return $return;
    }
24197
public function listFiles( $filter = NULL ) : array
    {
        $path = $this->path;

        if ( !file_exists($path) )    return NULL;

        if ( !is_readable($path) )    return NULL;

        if ( is_file($path) )    return NULL;

        $files = array();

        $dh = opendir($path);
        while( ($file_name = readdir($dh)) !== FALSE ){
            if ( $file_name === '.' || $file_name === '..' ){
                continue;
            }
            $file = new File( $file_name, $this );
            if ( $filter ){
                if ( $filter instanceof FileFilterInterface ){
                    if ( $filter->accept($file) ){
                        $files[] = $file;
                    }
                }
                else if ( is_callable($filter) ){
                    if ( $filter($file) ){
                        $files[] = $file;
                    }
                }
            }
            else{
                $files[] = $file;
            }
        }
        return $files;
    }
921371
protected function cleanFilters($filters): array
    {
        if (!is_array($filters)) {
            return array();
        }

        array_walk_recursive($filters, function (&$item, $key) {
            $item = trim($item);
        });

        $filters = array_filter($filters, function (&$item) {
            if (is_array($item)) {
                $item = array_filter($item, 'strlen');

                return !empty($item);
            }

            return strlen($item);
        });

        return $filters;
    }
111077
protected function getClassNameWithParams($filter)
    {
        $pattern = explode(':', $filter);

        $className = trim($pattern[0]);

        $params = [];

        if(isset($pattern[1])) {
            $params = array_map('trim', explode(',', $pattern[1]));
        }

        return [$className, $params];
    }
1317458
public function where(callable $filter)
    {
        $filtered = [];

        foreach ($this->array as $key => $value) {
            if ($filter($key, $value) === true) {
                $filtered[$key] = $value;
            }
        }

        return $filtered;
    }
1161085
public function getErrors($filter = null)
    {
        // Create an array to hold errors
        $messages = [];

        // If we have no errors, abort
        if ( ! $this->errors->count()) return $messages;

        foreach ($this->errors->toArray() as $key => $error)
        {
            $messages[$key] = $this->extractErrors($error);
        }

        // Return a specific set of messages if asked
        return array_get($messages, $filter);
    }
353087
private function applyFilter(Filter $filter)
    {
        list($filtered, $errors) = $filter->apply($this->value);
        if (count($errors) === 0) {
            return $filtered;
        }

        foreach ($errors as $error) {
            $this->paramErrors->append($this->paramName, $error);
        }

        return null;
    }
373679
public function getParamsWith($filter)
    {
        // Convert $filter to array if necessary
        if (!is_array($filter)) {
            $filter = preg_split("/, */", $filter, -1, PREG_SPLIT_NO_EMPTY);
        }

        $params = $this->getParams();
        $filter = array_flip($filter);

        return array_intersect_key($params, $filter);
    }
525859
public function getFields(bool $filter = true): array
    {
        $result = [];
        foreach ($this->fields as $name => $field) {
            $result[$name] = $this->getField($name, null, $filter);
        }

        return $result;
    }
122826
public static function filterByListLookup($filter)
    {
        $operator = Arr::get($filter, 'operator');
        $method = Arr::get($filter, 'method');
        $source = Arr::get($filter, 'settings.source');
        $arguments = Arr::get($filter, 'arguments');
        $value_one = Arr::get($filter, 'value_one');
        $value_two = Arr::get($filter, 'value_two');
        $settings = Arr::get($filter, 'settings');
        $positive = Arr::get($filter, 'positive');

        if (Arr::has($filter, 'settings.source')) {
            $model = Arr::get($filter, 'settings.model');

            $method_transform = 'transform'.Str::studly($source).'Value';

            if (method_exists($model, $method_transform)) {
                $value_one = $model->$method_transform($value_one);
            }

            $method_lookup = 'getFilter'.Str::studly($source).'Result';

            if (empty($value_one)) {
                return false;
            }

            if (method_exists($model, $method_lookup)) {
                $value_one = $model->$method_lookup($value_one);
            } else {
                throw new \Exception(sprintf('%s is missing method %s', $model->getTable(), $method_lookup));
            }

            if ($value_one === false) {
                return false;
            }

            $operator = 'IN';
            $method = 'whereIn';
            $arguments = [$value_one];
        } else {
            $value_one = [];
        }

        return [
            'operator'  => $operator,
            'method'    => $method,
            'arguments' => $arguments,
            'value_one' => $value_one,
            'value_two' => $value_two,
            'settings'  => $settings,
            'positive'  => $positive,
        ];
    }
644613
public static function getKeys($filter = []): array
    {
        /* @var $class LightModel */
        $className = get_called_class();
        $class = new $className;
        $tableKey = $class->getKeyName();

        $sql = 'SELECT ' . $tableKey . ' FROM ' . $class->getTableName() . ' WHERE 1=1';
        $params = self::handleFilter($sql, $filter, $class);

        $query = DB::getConnection()->prepare($sql);
        $query->execute($params);

        $res = [];

        foreach ($query->fetchAll() as $key => $value)
        {
            $res[] = $value[0];
        }

        return $res;
    }
599586
protected function getCachePagesEntries(string $filter): array
    {
        $rows = [];
        try {
            $cache = GeneralUtility::makeInstance(CacheService::class)->get();
        } catch (\Exception $exception) {
            $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
            $logger->error('Problems by fetching the cache: ' . $exception->getMessage() . ' / ' . $exception->getFile() . ':' . $exception->getLine());

            return $rows;
        }

        $dbRows = GeneralUtility::makeInstance(PageRepository::class)->findForBackend($this->getCurrentUid(), $this->getDisplayMode());

        foreach ($dbRows as $row) {
            $cacheEntries = $cache->getByTag('sfc_pageId_' . $row['uid']);
            foreach ($cacheEntries as $identifier => $info) {
                $cached = 0 === \count($info['explanation']);
                if ('all' !== $filter && (('cached' === $filter && !$cached) || ('notCached' === $filter && $cached))) {
                    continue;
                }

                $rows[] = [
                    'uid' => $row['uid'],
                    'title' => BackendUtility::getRecordTitle(
                        'pages',
                        $row,
                        true
                    ),
                    'identifier' => $identifier,
                    'info' => $info,
                ];
            }
        }

        return $rows;
    }
861339
public static function filterByList($filter)
    {
        $operator = Arr::get($filter, 'operator');
        $method = Arr::get($filter, 'method');
        $arguments = Arr::get($filter, 'arguments');
        $value_one = Arr::get($filter, 'value_one');
        $value_two = Arr::get($filter, 'value_two');
        $settings = Arr::get($filter, 'settings');
        $positive = Arr::get($filter, 'positive');

        switch ($operator) {
            case 'IN':
                $method = 'whereIn';
                $arguments = [$value_one];
                break;
            case 'NOT_IN':
                $method = 'whereNotIn';
                $arguments = [$value_one];
                break;
        }

        return [
            'operator'  => $operator,
            'method'    => $method,
            'arguments' => $arguments,
            'value_one' => $value_one,
            'value_two' => $value_two,
            'settings'  => $settings,
            'positive'  => $positive,
        ];
    }
687362
public static function decodeFilters(array $filters)
    {
        $decodedFilters = [];
        foreach ($filters as $property => $value) {
            $decodedFilters[] = ['value' => $value, 'property' => $property];
        }

        return $decodedFilters;
    }
1147491
public function getFilter($filter) {
        if ($this->hasFilter($filter)) {
            return $this->_filters[$filter];
        }

        throw new MissingFilterException(sprintf('Filter %s does not exist', $filter));
    }
177351
public function getMethods($filter = \ReflectionProperty::IS_PUBLIC)
    {
        $methods = array();
        $reflectionMethods = $this->reflectionEntity->getMethods($filter);
        foreach ($reflectionMethods as $method) {
            $methods[] = new Method($method->name, $method->isStatic());
        }

        return $methods;
    }
365006
public function getFilter($filter)
    {
        $result = null;

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

        return $result;
    }