@param ArrayCollection $unfiltered

@return ArrayCollection
349876
private function filterColumns(ArrayCollection $unfiltered)
    {
        $columnNames = $this->getColumnNames();

        $filtered = $unfiltered->filter(function (ColumnExpression $column) use ($columnNames) {
            return in_array($column->getColumnName(), $columnNames);
        });

        return new ArrayCollection($filtered->getValues());
    }
754454
protected function formatScopes($unformated = [])
    {
        $scopes = [];
        foreach ($unformated as $scope) {
            if ($scope instanceof ScopeEntity) {
                $scopes[$scope->getId()] = $scope;
            }
        }

        return $scopes;
    }
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;
        });
    }
371760
public function setFilterable(array $filterable): Repository
	{
		if ($filterable === self::ALLOW_ALL) {
			$this->filterable = self::ALLOW_ALL;

			return $this;
		}

		// Reset filterable
		$this->filterable = [];

		foreach ($filterable as $allowed_field) {
			$this->filterable[$allowed_field] = true;
		}

		return $this;
	}
979244
public function add($filter)
    {
        if (is_array($filter)) {
            $this->collection[] = new Filter($filter);
        } elseif (is_object($filter) && $filter instanceof Filter) {
            $this->collection[] = $filter;
        }

        return $this;
    }
1298627
public function Breadcrumbs($unlinked = false)
    {
        $items = parent::Breadcrumbs($unlinked);

        // The root element should explicitly point to the root node.
        // Uses session state for current record otherwise.
        $items[0]->Link = singleton('SilverStripe\\Reports\\ReportAdmin')->Link();

        if ($report = $this->reportObject) {
            $breadcrumbs = $report->getBreadcrumbs();
            if (!empty($breadcrumbs)) {
                foreach ($breadcrumbs as $crumb) {
                    $items->push($crumb);
                }
            }

            //build breadcrumb trail to the current report
            $items->push(new ArrayData(array(
                'Title' => $report->title(),
                'Link' => Controller::join_links(
                    $this->Link(),
                    '?' . http_build_query(array('q' => $this->request->requestVar('q')))
                )
            )));
        }

        return $items;
    }
190081
public function getCollection(HasMedia $model, string $collectionName, $filter = []): Collection
    {
        return $this->applyFilterToMediaCollection($model->loadMedia($collectionName), $filter);
    }
1269777
public function getFiltersArrays()
    {
        if (empty($this->filtersArrays)) {
            foreach ($this->getFilters() as $name => $filter) {
                $this->filtersArrays[$name] = $filter->getOptions();
            }
        }

        return $this->filtersArrays;
    }
458676
public function addFilters(array $filters)
    {
        foreach ($filters as $filter) {
            if ($filter instanceof QueryDSL) {
                $this->addFilter($filter);
            }
        }
        return $this;
    }
1285672
public function addFilter($filters)
    {
        $filters = (array) AnConfig::unbox($filters);

        foreach ($filters as $filter) {
            if (!($filter instanceof LibBaseTemplateFilterInterface)) {
                $filter = $this->getFilter($filter);
            }
            
            //Enqueue the filter in the command chain
            $this->getCommandChain()->enqueue($filter);
            
            //Store the filter
            $this->_filters[$filter->getIdentifier()->name] = $filter;
        }
        
        return $this;
    }
938246
public function addFilter($filters)
    {

        $filters = is_array($filters) ? $filters : func_get_args();

        foreach ($filters as $filter) {

            $this->filters[] = $filter;
        }

        return $this;
    }
979438
public function getIterator(IteratorFilter $filter = null)
    {
        if (is_null($filter)) {
            $filter = new IteratorFilter();
        }

        $param = [];
        $formatter = new IteratorFilterSqlFormatter();
        $sql = $formatter->getFilter($filter->getRawFilters(), $param);

        $query = Query::getInstance()
            ->table($this->getUserDefinition()->table())
            ->where($sql, $param);

        return $this->userRepository->getByQuery($query);
    }
1015185
public function filter(callable $predicate): ArrayCollection
    {
        $items = [];

        foreach ($this->items as $key => $value) {
            if ($predicate($value, $key)) {
                $items[$key] = $value;
            }
        }

        return new static($items);
    }
1080021
public static function find(Filter ...$filters)
    {
        $modelClass = get_called_class();
        $collection = new RepositoryCollection($modelClass);
        $collection->filter(...$filters);
        return $collection;
    }
285319
public function toArray($expandFilters = false)
    {
        $matches = $this->getFilterMatch();
        if ($expandFilters === true) {
            foreach ($matches as $index => $match) {
                $matches[$index] = $match->toArray();
            }
        }

        return array(
            'varName' => $this->getVarName(),
            'varValue' => $this->getVarValue(),
            'filterMatches' => $matches
        );
    }
386239
public function filter(array $filters)
	{
		foreach ($filters as $filter) {
			if ($filter->isValueSet()) {
				if ($filter->hasConditionCallback()) {
					$data = (array) call_user_func_array(
						$filter->getConditionCallback(),
						[$this->data, $filter->getValue()]
					);
					$this->setData($data);
				} else {
					$data = array_filter($this->data, function ($row) use ($filter) {
						return $this->applyFilter($row, $filter);
					});
					$this->setData($data);
				}
			}
		}

		return $this;
	}
1250090
public function filterAll(array $filters)
    {
        $filterList = [];
        foreach ($filters as $key => $value) {
            $filterList[] = $key . ':' . $value;
        }

        $result = $this->connection()->get($this->getEndpoint(), ['filter' => implode(',', $filterList)], true);

        return $this->collectionFromResult($result);
    }