list[$option->getId()] = $option; } } } /** * @param string $key * * @return OriginOptionInterface * @throws KeyNotFound */ public function getByKey(string $key) { if ( ! isset($this->list[$key])) { throw new KeyNotFound($key); } return $this->list[$key]; } public function getOptionsArray() { if (isset($this->list)) { $options = array(); foreach ($this->list as $id => $option) { $options[$id] = $option->get(); } return $options; } else { return false; } } }