src/precore/util/Iterators.php
public static function size(Iterator $iterator)
    {
        $result = 0;
        Iterators::each($iterator, function () use (&$result) {
            $result++;
        });
        return $result;
    }
public static function size(Iterator $iterator)
    {
        $result = 0;
        Iterators::each($iterator, function () use (&$result) {
            $result++;
        });
        return $result;
    }
Returns the number of elements in iterator.

@param Iterator $iterator
@return int