src/precore/util/Iterables.php
public static function size(IteratorAggregate $iterable) : int
    {
        if ($iterable instanceof Countable) {
            return $iterable->count();
        }
        return Iterators::size(Iterators::from($iterable->getIterator()));
    }
public static function size(IteratorAggregate $iterable) : int
    {
        if ($iterable instanceof Countable) {
            return $iterable->count();
        }
        return Iterators::size(Iterators::from($iterable->getIterator()));
    }
Returns the number of elements in iterable.

@param IteratorAggregate $iterable
@return int