Spot\Entity\Collection::filter PHP Method

filter() public method

Runs a function on every object in the query, returning an array containing every object for which the function returns true.
public filter ( $func ) : mixed
return mixed An array of Entity objects
    public function filter($func)
    {
        $ret = new static();
        foreach ($this as $obj) {
            if ($func($obj)) {
                $ret->add($obj);
            }
        }
        return $ret;
    }