. */ namespace vierbergenlars\AuthserverOAuthAccountBundle\ResourceOwner; class ResourceOwnerMapIterator implements \Iterator { /** * @var ResourceOwnerMap */ private $resourceOwnerMap; /** * @var string[] */ private $keySet; /** * @var int */ private $index = 0; /** * ResourceOwnerMapIterator constructor. * * @param ResourceOwnerMap $resourceOwnerMap * @param \string[] $keySet */ public function __construct(ResourceOwnerMap $resourceOwnerMap, array $keySet) { $this->resourceOwnerMap = $resourceOwnerMap; $this->keySet = $keySet; } public function current() { return $this->resourceOwnerMap->offsetGet($this->keySet[$this->index]); } public function next() { $this->index++; } public function key() { return $this->keySet[$this->index]; } public function valid() { return isset($this->keySet[$this->index]); } public function rewind() { $this->index = 0; } }