gielfeldt/iterators

View on GitHub
src/CloningIterator.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace Gielfeldt\Iterators;

class CloningIterator extends TraversableIterator
{
    public function key()
    {
        $key = parent::key();
        return is_object($key) ? clone $key : $key;
    }

    public function current()
    {
        $current = parent::current();
        return is_object($current) ? clone $current : $current;
    }
}