Filter the provided result set by languages that are available at the frontend.

@param CollectionInterface $results The collection to filter.
@return FilterIterator
496247
public function filterFrontend(CollectionInterface $results)
    {
        return $results->filter(function (Language $language) {
            return $language->available_at_frontend === true;
        });
    }
266261
private function showResultList(OutputInterface $output, array $results)
    {
        foreach ($results as $name) {
            $output->writeln(
                sprintf(
                    " → '%s'%s",
                    $name,
                    $this->getPomm()->isDefaultSession($name)
                        ? '(default)'
                        : ''
                )
            );
        }

        return $this;
    }
765819
protected function filterResult(array $result) {
        foreach($result as $index => $user) {
            if (!is_object($user)) {
                throw new XjtuWebServiceException('Invalid response from web service server.');
            }
            foreach($user as $key => $val ) {
                if (!in_array($key, $this->fields) || in_array($key, $this->filter)) {
                    unset($user->$key);
                }
            }
            
            // $result[$index] = (array) $user;
        }
        return $result;
    }
741865
protected function buildDictionary(Collection $results)
    {
        // First we will build a dictionary of child models keyed by the foreign key
        // of the relation so that we will easily and quickly match them to their
        // parents without having a possibly slow inner loops for every models.
        $dictionary = [];

        foreach ($results as $result) {
            $dictionary[$result->{$this->accessor}->{$this->foreignPivotKey}][] = $result;
        }

        return $dictionary;
    }
666773
public function map($results, $model)
    {
        if (count($results['ids']) === 0) {
            return Collection::make();
        }

        $keys = collect($results['ids'])->values()->all();
        $fieldsWheres = array_keys($this->builder->wheres);
        $models = $model->whereIn(
            $model->getQualifiedKeyName(),
            $keys
        )->get()->keyBy($model->getKeyName());

        return collect($results['ids'])->map(function ($hit) use ($models) {
            return $models->has($hit) ? $models[$hit] : null;
        })->filter(function ($model) use ($fieldsWheres) {
            return ! is_null($model) && array_reduce($fieldsWheres, function ($carry, $item) use ($model) {
                return $carry && $model[$item] == $this->builder->wheres[$item];
            }, true);
            ;
        });
    }
589494
public function setResults($results)
    {
        // hydrate model
        foreach ($results as $entry) {
            /** @var EntityDataModel $model */
            $model = $this->getModel();
            $model->setEntityManager($this->getEntityManager());

            // check for json
            if (array_key_exists('[json]', $entry)) {
                $entry = json_decode($entry['[json]']);
            }

            $model = $this->populate($entry, $model);

            $this->collection[] = $model;
        }

        $this->setCount(count($this->collection));

        return $this;
    }
71963
public function search(array $filters)
    {
        return $this->filter(function (CollectionableInterface $entity) use ($filters) {
            $res = true;
            foreach ($filters as $key => $value) {
                $current = $this->getPropertyAccessor()->getValue($entity, $key);
                $res = $res && (is_array($value) ?
                    in_array($current, $value) :
                    $current == $value
                );
            }

            return $res;
        });
    }
390255
public function parseResults($results): Fluent
    {
        $parsed = [];
        $lines = explode("\n", $results);

        foreach ($lines as $line) {
            if (empty($line)) {
                continue;
            }

            $line = explode(':', $line, 2);
            $parsed[$line[0]] = $line[1];
        }

        return new Fluent($parsed);
    }
488244
public function mapResult(ResultIterator $result, $resultType = ArrayType::BOTH) {
		//check numer of rows returned
		if ($result->countRows() == 0)
			return null;

		//get result column types
		$this->columnTypes = $result->getColumnTypes($resultType);
		
		//validate result map (if any)
		if (isset($this->resultMap))
			$this->buildTypeHandlerList();

		//map row
		return $this->map($result->fetchArray($resultType));
	}
1031735
public function matchOne(array $models, Collection $results, $relation)
    {
        return $this->matchOneOrMany($models, $results, $relation, 'one');
    }
927900
public function filter($collection = null, $iterator = null)
    {
        $return = array();
        foreach ($collection as $val) {
            if (call_user_func($iterator, $val)) {
                $return[] = $val;
            }
        }
        return $return;
    }
22189
protected function getFilters(): FilterCollection
    {
        if ($this->filters === null) {
            $this->filters = new FilterCollection();
            $this->filters->addFilter(new UserFilter());
        }
        return $this->filters;
    }
104980
public function map(Builder $builder, $results, $model)
    {
        if (empty($results)) {
            return Collection::make();
        }

        $keys = $this->mapIds($results);

        $results = collect($results);

        $models = $model->whereIn($model->getKeyName(), $keys->all())
            ->get()
            ->keyBy($model->getKeyName());

        return $results->pluck($model->getKeyName())
            ->intersect($models->keys()) // Filter out no longer existing models (i.e. soft deleted)
            ->map(function ($key) use ($model, $models) {
                return $models[$key];
            });
    }
1062769
protected function loadIncludes(array $results): void
	{
		$includes = $this->parseIncludes();

		foreach($includes['this'] as $include => $criteria)
		{
			$forward = $includes['forward'][$include] ?? [];

			$results[0]->$include()->eagerLoad($results, $include, $criteria, $forward);
		}
	}
709941
protected function doApplyFilters(array $results, Server $server)
    {

        // Loop over the filters
        foreach ($this->options['filters'] as $filterOptions) {
            // Try to do this filter
            try {
                // Make a new reflection class
                $class = new \ReflectionClass(sprintf('GameQ\\Filters\\%s', ucfirst($filterOptions['filter'])));

                // Create a new instance of the filter class specified
                $filter = $class->newInstanceArgs([$filterOptions['options']]);

                // Apply the filter to the data
                $results = $filter->apply($results, $server);
            } catch (\ReflectionException $e) {
                // Invalid, skip it
                continue;
            }
        }

        return $results;
    }
809838
protected function filterResult(Result $result)
    {
        $request = $result->getData('request') ?: array();
        foreach (array('AccountNumber', 'RoutingNumber') as $key) {
            if (array_key_exists($key, $request)) {
                $request[$key] = '[filtered]';
            }
        }

        $result->setData('request', $request);

        return $result;
    }
250853
public static function filter(array $collection, $expression, array $context = [])
    {
        $language = new ExpressionLanguage();

        $result = [];
        foreach ($collection as $key => $item) {
            if ($language->evaluate($expression, array_merge($context, ['item' => $item, 'key' => $key]))) {
                $result[$key] = $item;
            }
        }

        return $result;
    }