src/precore/util/Iterables.php
public static function filter(IteratorAggregate $unfiltered, callable $predicate) : IteratorAggregate
    {
        return new CallableIterable(
            function () use ($unfiltered, $predicate) {
                return Iterators::filter(Iterators::from($unfiltered->getIterator()), $predicate);
            }
        );
    }
public static function filter(IteratorAggregate $unfiltered, callable $predicate) : IteratorAggregate
    {
        return new CallableIterable(
            function () use ($unfiltered, $predicate) {
                return Iterators::filter(Iterators::from($unfiltered->getIterator()), $predicate);
            }
        );
    }
Returns the elements of unfiltered that satisfy a predicate.

@param IteratorAggregate $unfiltered
@param callable $predicate
@return IteratorAggregate