keys = []; foreach ($keys as $id => $key) { $this->keys[$id] = new Key($id, $key); } } /** * @param string $keyId * * @return Key * * @throws KeyStoreException */ public function fetch($keyId) { if (isset($this->keys[$keyId])) { return $this->keys[$keyId]; } else { throw new KeyStoreException("Key '$keyId' not found"); } } }