Filters the complex array structure for variable classes
@param array $structure as defined by getStructuredVariables()
@param array $filter classes to keep
@return array as defined by getStructuredVariables()
496885
public function filterStructuredVariables(array $structure, array $filter)
    {
        $all = [
            \taoResultServer_models_classes_ResponseVariable::class,
            \taoResultServer_models_classes_OutcomeVariable::class,
            \taoResultServer_models_classes_TraceVariable::class
        ];
        $toRemove = array_diff($all, $filter);
        $filtered = $structure;
        foreach ($filtered as $timestamp => $entry) {
            foreach ($entry as $key => $value) {
                if (in_array($key, $toRemove)) {
                    unset($filtered[$timestamp][$key]);
                }
            }
        }
        return $filtered;
    }
567016
public CmsRelationFilter filterStructureId(CmsUUID structureId) {

        CmsRelationFilter filter = (CmsRelationFilter)clone();
        filter.m_structureId = structureId;
        return filter;
    }
1359468
public function buildClassMethods(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, array &$result)
    {
        $namespace = $structure->getNamespace();

        if ($namespace) {
            $namespace = '\\' . ltrim($namespace, '\\');
        }

        $this->buildGetFinderMethod($structure, $source_type, $target_type, $namespace, $result);

        $result[] = '';
        $result[] = '    /**';
        $result[] = '     * Return ' . Inflector::singularize($source_type->getName()) . ' ' . $this->getName() . '.';
        $result[] = '     *';
        $result[] = '     * @return ' . $this->getInstanceClassFrom($namespace, $target_type) . '[]';
        $result[] = '     */';
        $result[] = "    public function get{$this->getClassifiedAssociationName()}()";
        $result[] = '    {';
        $result[] = '        return $this->' . $this->getFinderMethodName() . '()->all();';
        $result[] = '    }';

        $result[] = '';
        $result[] = '    /**';
        $result[] = '     * Return ' . Inflector::singularize($source_type->getName()) . ' ' . Inflector::singularize($this->getName()) . ' ID-s.';
        $result[] = '     *';
        $result[] = '     * @return int[]';
        $result[] = '     */';
        $result[] = '    public function get' . Inflector::classify(Inflector::singularize($this->getName())) . 'Ids()';
        $result[] = '    {';
        $result[] = '        return $this->' . $this->getFinderMethodName() . '()->ids();';
        $result[] = '    }';

        $result[] = '';
        $result[] = '    /**';
        $result[] = '     * Return number of ' . Inflector::singularize($source_type->getName()) . ' ' . $this->getName() . '.';
        $result[] = '     *';
        $result[] = '     * @return int';
        $result[] = '     */';
        $result[] = "    public function count{$this->getClassifiedAssociationName()}()";
        $result[] = '    {';
        $result[] = '        return $this->' . $this->getFinderMethodName() . '()->count();';
        $result[] = '    }';

        $this->buildAddRelatedObjectMethod($structure, $source_type, $target_type, $namespace, $result);
        $this->buildRemoveRelatedObjectMethod($structure, $source_type, $target_type, $namespace, $result);
        $this->buildClearRelatedObjectsMethod($structure, $source_type, $target_type, $namespace, $result);
    }
39380
private function extractFilterVars(array $filter)
    {
        $collection = array_key_exists('collection', $filter) ? $filter['collection'] : null;
        $systemCollections = array_key_exists('systemCollections', $filter) ? $filter['systemCollections'] : true;
        $types = array_key_exists('types', $filter) ? $filter['types'] : null;
        $search = array_key_exists('search', $filter) ? $filter['search'] : null;
        $orderBy = array_key_exists('orderBy', $filter) ? $filter['orderBy'] : null;
        $orderSort = array_key_exists('orderSort', $filter) ? $filter['orderSort'] : null;
        $ids = array_key_exists('ids', $filter) ? $filter['ids'] : null;

        return [$collection, $systemCollections, $types, $search, $orderBy, $orderSort, $ids];
    }
857377
protected function filter(array $filter)
    {
        // email
        if(array_key_exists('authEmail', $filter) && strlen($filter['authEmail']) > 0) {
            $this->select->where->like('auth.auth_email', $filter['authEmail'] . '%');
        }
        
        //auth id
        if(array_key_exists('authId', $filter) && $filter['authId'] > 0) {
            $this->select->where(array(
                'history.auth_id = ?' => $filter['authId']
            ));
        }
        
        return $this;
    }
366436
public function filter(/*Callable*/ $filter)
    {
        $result = clone $this;
        foreach ($this as $object)
        {
            if (call_user_func($filter, $object) === false) {
                $result->remove($object);
            }
        }

        return $result;
    }
264176
public function createViewProxy(StructureInterface $structure, array $data)
    {
        return $this->proxyFactory->createProxy(
            \ArrayObject::class,
            function (
                &$wrappedObject,
                LazyLoadingInterface $proxy,
                $method,
                array $parameters,
                &$initializer
            ) use ($structure, $data) {
                $initializer = null;
                $wrappedObject = new \ArrayObject($this->resolveView($structure, $data));

                return true;
            }
        );
    }
136534
private function filterPrefixer(array &$filter)
    {
        foreach ($filter as &$child) {
            if (\array_key_exists('property', $child)
                && (false === \strpos($child['property'], $this->source . '.'))
                && $this->fieldExists($child['property'])
            ) {
                $child['property'] = $this->source . '.' . $child['property'];
            }

            if (\array_key_exists('children', $child)) {
                $this->filterPrefixer($child['children']);
            }
        }
    }
759724
public function seeJsonStructure(array $structure = null, $responseData = null)
    {
        if (is_null($structure)) {
            return $this->seeJson();
        }

        if (is_null($responseData)) {
            $responseData = $this->decodeResponseJson();
        }

        foreach ($structure as $key => $value) {
            if (is_array($value) && $key === '*') {
                $this->assertIsArray($responseData);

                foreach ($responseData as $responseDataItem) {
                    $this->seeJsonStructure($structure['*'], $responseDataItem);
                }
            } elseif (is_array($value)) {
                $this->assertArrayHasKey($key, $responseData);
                $this->seeJsonStructure($structure[$key], $responseData[$key]);
            } else {
                $this->assertArrayHasKey($value, $responseData);
            }
        }

        return $this;
    }
742184
def append_filter(self, structure_filter):
        
        hdict = structure_filter.as_dict()
        hdict["input_structure"] = self.final_structure.as_dict()
        self.history.append(hdict)
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);
        }
    }
467613
public function hydrate( array $data, $structure )
    {
        if ( ! empty( $data['file'] ) )
        {
            if ( ! empty( $data['file']['tmp_name'] ) )
            {
                $data['name'] = $data['file']['name'];
                $data['code'] = @ file_get_contents( $data['file']['tmp_name'] );
                @ unlink( $data['file']['tmp_name'] );
            }

            unset( $data['file'] );
        }

        if ( ! empty( $data['type'] ) )
        {
            $data['name'] .= '.' . $data['type'];
            unset( $data['type'] );
        }

        if ( $structure instanceof StructureAbstract )
        {
            $structure->setOptions( $data );
        }
        else
        {
            foreach ( $data as $key => $value )
            {
                $structure->$key = $value;
            }
        }

        if ( $structure instanceof MapperAwareInterface )
        {
            $structure->setMapper( $this );
        }

        return $structure;
    }
743849
public function filter($filter = 'image.filters.default')
    {
        $filters = (array) $this->get($filter, []);
        foreach ($filters as $params) {
            $params = (array) $params;
            $method = array_shift($params);
            $this->__call($method, $params);
        }
    }
906829
public function findFiltered(array $filters)
    {
        /* @var Unit[] $units */
        if (!isset($filters['domain']) || is_null($filters['domain']) || empty($filters['domain'])) {
            $units = $this->findAll();
        } else {
            $units = $this->findByDomain($filters['domain']);
        }

        foreach ($units as $k => $u) {
            $filterEmpty = isset($filters['empty']) && $filters['empty'];
            $filterKey = isset($filters['key']) && strlen(trim($filters['key'])) > 0 ? trim($filters['key']) : null;
            $filterValue = isset($filters['value']) && strlen(trim($filters['value'])) > 0 ? trim($filters['value']) : null;
            if (empty($filters['locale'])) {
                $filters['locale'] = $this->getLocaleList();
            }

            if ($filterKey && strpos($u->getKey(), $filterKey) === false) {
                unset($units[$k]);
                continue;
            }

            $nonEmptyCount = 0;
            $valueCount = 0;
            foreach ($u->getTranslations() as $t) {
                // Remove translations not required
                if (!in_array($t->getLocale(), $filters['locale'])) {
                    unset($u[$t->getLocale()]);
                    continue;
                }

                // Count empty or match values
                $value = $t->getValue();
                if ($value !== null && strlen($value) > 0) {
                    ++$nonEmptyCount;
                }
                if ($filterValue && strpos($value, $filterValue) !== false) {
                    ++$valueCount;
                }
            }

            // For empty filtering, remove unit with non empty translations
            if ($filterEmpty && $nonEmptyCount >= count($filters['locale'])) {
                unset($units[$k]);
                continue;
            }

            // For value filtering, remove unit when there is no match
            if ($filterValue && $valueCount == 0) {
                unset($units[$k]);
                continue;
            }
        }

        return $units;
    }
1162956
private function convertFilterProps(array $filter)
    {
        if (isset($filter['propertyFilter'])) {
            $operator = $filter['propertyFilter']['op'];

            $constName = PropertyFilterOperator::class . '::' . $operator;
            if (!defined($constName)) {
                throw new \InvalidArgumentException('Invalid operator.');
            }

            $filter['propertyFilter']['op'] = constant($constName);
        }

        if (isset($filter['compositeFilter'])) {
            $filter['compositeFilter']['op'] = CompositeFilterOperator::PBAND;

            foreach ($filter['compositeFilter']['filters'] as &$nested) {
                $nested = $this->convertFilterProps($nested);
            }
        }

        return $filter;
    }
1200460
public function getMethods($filter = -1)
    {
        $return = parent::getMethods($filter);
        foreach ($return as $key => $val) {
            $return[$key] = new ReflectionMethod($this->getName(), $val->getName());
        }

        return $return;
    }
993870
public function getHlblocks($filter = array()) {
        $dbres = HL\HighloadBlockTable::getList(
            array(
                'select' => array('*'),
                'filter' => $filter,
            )
        );

        $result = [];
        while ($hlblock = $dbres->fetch()) {
            $hlblock['LANG'] = $this->getHblockLangs($hlblock['ID']);
            $result[] = $hlblock;
        }

        return $result;
    }