list[$option->getId()] = $option; } } } /** * @param string $key * * @return OriginOptionInterface * @throws KeyNotFound */ public function getByKey(string $key) { if ( ! isset($this->list[$key])) { //phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new KeyNotFound($key); } return $this->list[$key]; } public function getOptionsArray($default = false) { if (isset($this->list)) { $options = array(); foreach ($this->list as $id => $option) { $options[$id] = $default ? $option->getDefault() : $option->get(); } return $options; } else { return false; } } }