src/Utilities/GeneratorUtility.php
public static function getGeneratorElements(Generator $generator)
    {
        $elements = [];

        for (; $generator->valid(); $generator->next()) {
            $elements[] = $generator->current();
        }

        return $elements;
    }
public static function getGeneratorElements(Generator $generator)
    {
        $elements = [];

        for (; $generator->valid(); $generator->next()) {
            $elements[] = $generator->current();
        }

        return $elements;
    }
public static function getGeneratorElements ( Generator $ generator ) { $ elements = [ ] ; for ( ; $ generator -> valid ( ) ; $ generator -> next ( ) ) { $ elements [ ] = $ generator -> current ( ) ; } return $ elements ; }
Returns elements of generator

@param Generator $generator The generator who elements should be returned
@return array
Returns elements of generator