@param ResourceInterface       $resource
@param FieldSetFilterInterface $filter

@return array
353923
protected function getResourceRepresentation(ResourceInterface $resource, FieldSetFilterInterface $filter): array
    {
        $representation = [
            DocumentInterface::KEYWORD_TYPE => $resource->getType(),
        ];

        if (($index = $resource->getId()) !== null) {
            $representation[DocumentInterface::KEYWORD_ID] = $index;
        }

        $attributes = $this->getAttributesRepresentation($filter->getAttributes($resource));
        if (empty($attributes) === false) {
            \assert(
                \json_encode($attributes) !== false,
                'Attributes for resource type `' . $resource->getType() .
                '` cannot be converted into JSON. Please check its Schema returns valid data.'
            );
            $representation[DocumentInterface::KEYWORD_ATTRIBUTES] = $attributes;
        }

        $relationships = $this->getRelationshipsRepresentation($filter->getRelationships($resource));
        if (empty($relationships) === false) {
            \assert(
                \json_encode($relationships) !== false,
                'Relationships for resource type `' . $resource->getType() .
                '` cannot be converted into JSON. Please check its Schema returns valid data.'
            );
            $representation[DocumentInterface::KEYWORD_RELATIONSHIPS] = $relationships;
        }

        if ($resource->hasLinks() === true) {
            $links = $this->getLinksRepresentation($this->getUrlPrefix(), $resource->getLinks());
            \assert(
                \json_encode($links) !== false,
                'Links for resource type `' . $resource->getType() .
                '` cannot be converted into JSON. Please check its Schema returns valid data.'
            );
            $representation[DocumentInterface::KEYWORD_LINKS] = $links;
        }

        if ($resource->hasResourceMeta() === true) {
            $meta = $resource->getResourceMeta();
            \assert(
                \json_encode($meta) !== false,
                'Meta for resource type `' . $resource->getType() .
                '` cannot be converted into JSON. Please check its Schema returns valid data.'
            );
            $representation[DocumentInterface::KEYWORD_META] = $meta;
        }

        return $representation;
    }
1112366
protected function filterSources(array $sources, FilterInterface $filter)
    {
        $filteredSources = [];

        // if the filter supports no extension, there is an error
        if (!is_array($filter->getSupportedExtensions()) || !count($filter->getSupportedExtensions())) {
            throw new Exception('No supported extensions found for the filter '.$filter->getName());
        }

        foreach ($sources as $source) {
            $isExtensionSupported = in_array($source->getExtension(), $filter->getSupportedExtensions());
            $supportAllExtensions = in_array('*', $filter->getSupportedExtensions());

            if ($isExtensionSupported || $supportAllExtensions) {
                $filteredSources[] = $this
                    ->locator
                    ->getNormalizer()
                    ->normalize($source);
            }
        }

        return $filteredSources;
    }
1185691
public static function fieldsKey($table, $filter="id") {

        try {
            $row = (array) self::findRow("select * from ".$table, "assoc");
            // remove array element base on filter if _none_ no filter
            if (strtolower($filter)!="_none_") {
                // default is to filter id field
                unset($row[$filter]);
            }
            return array_keys($row);
        } catch (Exception $e) {
            echo $e->getTraceAsString();
        }        
    }
814518
public function getRelatedResourceSet(
        QueryType $queryType,
        ResourceSet $sourceResourceSet,
        $sourceEntityInstance,
        ResourceSet $targetResourceSet,
        ResourceProperty $targetProperty,
        $filterInfo = null,
        $orderBy = null,
        $top = null,
        $skip = null
    ) {
        // Correct filter
        $srcClass = get_class($sourceEntityInstance);
        $filterFieldName = $this->getTableName($this->getEntityName($srcClass)) . '_id';
        $navigationPropertiesUsedInTheFilterClause = null;
        $filterExpAsDataSourceExp = '';
        if ($filterInfo) {
            $navigationPropertiesUsedInTheFilterClause = $filterInfo->getNavigationPropertiesUsed();
            $filterExpAsDataSourceExp = $filterInfo->getExpressionAsString();
        }
        $filterExpAsDataSourceExp .= $filterExpAsDataSourceExp ? ' AND ' : '';
        $filterExpAsDataSourceExp .= $filterFieldName . ' = ' . $sourceEntityInstance->id;
        $completeFilterInfo = new FilterInfo($navigationPropertiesUsedInTheFilterClause, $filterExpAsDataSourceExp);

        return $this->getResourceSet($queryType, $targetResourceSet, $completeFilterInfo, $orderBy, $top, $skip);
    }
386110
public function load($resource, array $filters = array())
    {
        $filters = array_merge($this->filters, $filters);

        $matches = array();
        if (preg_match('/^(.*)\:(\d+)-(\d+|\*)$/', $resource, $matches)) {
            $resource = $matches[1];
            $filters[] = new LineRangeFilter($matches[2], $matches[3]);
        } elseif (preg_match('/^(.*)\:(\d+)$/', $resource, $matches)) {
            $resource = $matches[1];
            $filters[] = new LineFilter($matches[2]);
        }

        $loader = $this->resolveLoader($resource);

        if (null === $loader) {
            return array();
        }

        $features = array();
        foreach ($loader->load($resource) as $feature) {
            foreach ($filters as $filter) {
                $feature = $filter->filterFeature($feature);

                if (!$feature->hasScenarios() && !$filter->isFeatureMatch($feature)) {
                    continue 2;
                }
            }

            $features[] = $feature;
        }

        return $features;
    }
1158404
public function getUrlOfFilteredImageWithRuntimeFilters($path, $filter, array $runtimeFilters = [], $resolver = null)
    {
        $runtimePath = $this->cacheManager->getRuntimePath($path, $runtimeFilters);
        if ($this->cacheManager->isStored($runtimePath, $filter, $resolver)) {
            return $this->cacheManager->resolve($runtimePath, $filter, $resolver);
        }

        $filteredBinary = $this->createFilteredBinary(
            $path,
            $filter,
            $runtimeFilters
        );

        $this->cacheManager->store(
            $filteredBinary,
            $runtimePath,
            $filter,
            $resolver
        );

        return $this->cacheManager->resolve($runtimePath, $filter, $resolver);
    }
426198
@Override
    public Set<Class<?>> getDeclaredInterfaces(ClassFilter filter) {
       return ClassUtils.getDeclaredInterfaces(target, filter);
    }
225293
public function getAll($filter = null, Subject $parent = null)
    {
        return $this->connector->getAll(__NAMESPACE__, $filter, $parent);
    }
1207709
public function getSetters($filter = \ReflectionProperty::IS_PUBLIC)
    {
        $setters = array();
        $methods = $this->getMethods($filter);
        foreach ($methods as $method) {
            if (substr($method->getName(), 0, 3) === 'set') {
                $setters[] = $method;
            }
        }

        return $setters;
    }
70849
public static function getOptionSets($filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCollection('/optionsets' . $filter->toQuery(), 'OptionSet');
    }
710142
public function reflect(FilterInterface $filter = null)
    {
        $exprParts = array();

        /**
         * @var $rule \IMT\DataGrid\Filter\RuleInterface
         */
        foreach ($filter->getRules() as $rule) {
            $ruleReflectionClass = sprintf(
                '%s\Rule\%sRuleReflection',
                __NAMESPACE__,
                ucfirst($rule->getOperator())
            );

            if (!class_exists($ruleReflectionClass)) {
                throw new ReflectionNotFoundException(
                    sprintf(
                        'The data grid filter rule reflection class named `%s` '
                        . 'does not exist.',
                        $ruleReflectionClass
                    )
                );
            }

            /**
             * @var $ruleReflection ReflectionInterface
             */
            $ruleReflection = new $ruleReflectionClass($this->queryBuilder);

            $exprParts[] = $ruleReflection->reflect($rule);
        }

        $exprOperation = mb_strtolower($filter->getOperator()) . 'X';
        $expr = call_user_func_array(
            array($this->queryBuilder->expr(), $exprOperation),
            $exprParts
        );

        $nestedExprParts = array();

        foreach ($filter->getFilters() as $nestedFilter) {
            $nestedExprParts[] = $this->reflect($nestedFilter);
        }

        if (count($nestedExprParts) == 0) {
            return $expr;
        }

        return call_user_func_array(
            array($this->queryBuilder->expr(), 'andX'),
            array_merge(array($expr), $nestedExprParts)
        );
    }
1033638
private function getSearch(string $resourceClass, array $parts, array $filters): array
    {
        $variables = [];
        $mapping = [];
        foreach ($filters as $filter) {
            foreach ($filter->getDescription($resourceClass) as $variable => $data) {
                $variables[] = $variable;
                $mapping[] = [
                    '@type' => 'IriTemplateMapping',
                    'variable' => $variable,
                    'property' => $data['property'],
                    'required' => $data['required'],
                ];
            }
        }

        return [
            '@type' => 'hydra:IriTemplate',
            'hydra:template' => sprintf('%s{?%s}', $parts['path'], implode(',', $variables)),
            'hydra:variableRepresentation' => 'BasicRepresentation',
            'hydra:mapping' => $mapping,
        ];
    }
185213
public function buildFilterRulesForFilterSetting($filter)
    {
        if (!$this->get('select_filter')) {
            return;
        }

        // Set Filter and co.
        $filterSettings = $this->filterSettingFactory->createCollection($this->get('select_filter'));

        if ($filterSettings) {
            $values       = $_GET;
            $presets      = (array) $this->get('select_filterparams');
            $presetNames  = $filterSettings->getParameters();
            $filterParams = \array_keys($filterSettings->getParameterFilterNames());
            $processed    = [];

            // We have to use all the preset values we want first.
            foreach ($presets as $presetName => $preset) {
                if (\in_array($presetName, $presetNames)) {
                    $processed[$presetName] = $preset['value'];
                }
            }

            // Now we have to use all FrontEnd filter params, that are either:
            // * not contained within the presets
            // * or are overridable.
            foreach ($filterParams as $parameter) {
                // Unknown parameter? - next please.
                if (!\array_key_exists($parameter, $values)) {
                    continue;
                }

                // Not a preset or allowed to override? - use value.
                if ((!\array_key_exists($parameter, $presets)) || $presets[$parameter]['use_get']) {
                    $processed[$parameter] = $values[$parameter];
                }
            }

            $filterSettings->addRules($filter, $processed);
        }
    }
506883
public function getAll($classname, $filter = null, AbstractModel $parent = null)
    {
        $filterUrl = '';
        if (!is_null($filter)) {
            if (
                isset($this->filters[$classname]) &&
                in_array($filter, $this->filters[$classname])) {

                $filterUrl = '/filter/' . $filter;
            } elseif (
                isset($this->filters[$classname]) &&
                preg_match('/^[0-9]+$/D', $filter)) {

                $filterUrl = '/filter/' . $filter;
            } else {
                $message = 'Unknown filter "' . $filter . '" for ' . $classname;
                if (isset($this->filters[$classname])) {
                    $message .= '; available filters: ' . implode(', ', $this->filters[$classname]);
                }
                throw new InvalidFilterException($message);
            }
        }

        $response = $this->request($this->buildUrl(new $classname(), $parent, $filterUrl), 'GET');
        return $this->mapper->mapFromStorage($response);
    }
1238074
public static function parseFilter2( array $requestFilters, EarthIT_Schema_ResourceClass $rc, EarthIT_Schema $schema ) {
		$filterComponents = array();
		foreach( $requestFilters as $filter ) {
			$filterComponents[] = EarthIT_Storage_ItemFilters::parsePattern(
				$filter['fieldName'], $filter['pattern'],
				$rc, $schema, true );
		}
		return EarthIT_Storage_ItemFilters::anded($filterComponents);
	}
756753
public static function fromResource(ResourceInterface $resource, $path)
	{
		if ($resource instanceof FileResourceInterface) {
			return $resource;
		}
		file_put_contents($path, $resource->getStream());
		$attr = [
			'mimetype' => $resource->getMimetype(),
			'lastmodified' => $resource->getLastModified(),
			'filename' => $resource->getFilename()
		];
		return new FileResource($path, $attr);
	}
1355326
private function parseFilters(TableInterface $table, Request $request)
    {
        $filters = [];

        $queryParams = $request->get($table->getFormId());

        foreach ($table->getAllFilters() as $filter) {
            if (isset($queryParams[$filter->getName()])) {
                $searchParamRaw = trim($queryParams[$filter->getName()]);
                if ($searchParamRaw != '') {
                    $filters[$filter->getName()] = $searchParamRaw;
                }
            }
        }

        return $filters;
    }