list[$constant->getId()] = $constant; } } } /** * @param string $key * * @return Constant * @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]; } }