private function rewind($traversable, $key)
    {
        if ($key === null) {
            return;
        }

        if (is_array($traversable)) {
            foreach ($traversable as $currentKey => $value) {
                if ($currentKey === $key) {
                    break;
                }
            }
        } else {
            $traversable->rewind();
            while ($traversable->valid() && $key !== $traversable->key()) {
                $traversable->next();
            }
        }
    }
private function rewind($traversable, $key)
    {
        if ($key === null) {
            return;
        }

        if (is_array($traversable)) {
            foreach ($traversable as $currentKey => $value) {
                if ($currentKey === $key) {
                    break;
                }
            }
        } else {
            $traversable->rewind();
            while ($traversable->valid() && $key !== $traversable->key()) {
                $traversable->next();
            }
        }
    }
private function rewind ( $ traversable , $ key ) { if ( $ key === null ) { return ; } if ( is_array ( $ traversable ) ) { foreach ( $ traversable as $ currentKey => $ value ) { if ( $ currentKey === $ key ) { break ; } } } else { $ traversable -> rewind ( ) ; while ( $ traversable -> valid ( ) && $ key !== $ traversable -> key ( ) ) { $ traversable -> next ( ) ; } } }
rewinds traversable to given key to not change state of traversable

@param  array|\Iterator    $traversable
@param  int|string  $key
rewinds traversable to given key to not change state of traversable