. */ namespace vierbergenlars\AuthserverOAuthAccountBundle\ResourceOwner; class ResourceOwnerMap implements \ArrayAccess, \IteratorAggregate { private $config; public function __construct(array $config) { $this->config = $config; } public function offsetExists($offset) { return isset($this->config[$offset]); } public function offsetGet($offset) { if(!$this->config[$offset] instanceof ResourceOwnerConfig) $this->config[$offset] = new ResourceOwnerConfig($this->config[$offset]); return $this->config[$offset]; } public function offsetSet($offset, $value) { throw new \LogicException(sprintf('%s is frozen.', self::class)); } public function offsetUnset($offset) { throw new \LogicException(sprintf('%s is frozen.', self::class)); } public function getIterator() { return new ResourceOwnerMapIterator($this, array_keys($this->config)); } }