Skip to content

Commit

Permalink
Add rewind storage and move get key and value
Browse files Browse the repository at this point in the history
  • Loading branch information
cwreden committed Feb 1, 2021
1 parent bcef5c1 commit ad4e4b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Guard.php
Expand Up @@ -297,11 +297,13 @@ protected function getLastKeyPair(): ?array
$value = $this->storage[$name];
reset($this->storage);
} elseif ($this->storage instanceof Iterator) {
$this->storage->rewind();
while ($this->storage->valid()) {
$name = $this->storage->key();
$value = $this->storage->current();
$this->storage->next();
}
$name = $this->storage->key();
$value = $this->storage->current();
$this->storage->rewind();
}

return $name !== null && $value !== null
Expand Down

0 comments on commit ad4e4b0

Please sign in to comment.