This block could simply be:

`$files = iterator_to_array($iterator);`