response[$id] ?? null; } /** * Add response. * * @param mixed $key Response id * @param mixed $response Response to add * @param bool $overwrite Overwrite * * @return void * * @since 1.0.0 */ public function set($key, $response, bool $overwrite = true) : void { // This is not working since the key contains :: from http:// //$this->response = ArrayUtils::setArray((string) $key, $this->response, $response, ':', $overwrite); $this->response[$key] = $response; } /** * {@inheritdoc} */ public function jsonSerialize() { return $this->toArray(); } /** * Generate response array from views. * * @return array * * @throws \Exception * * @since 1.0.0 */ abstract public function toArray() : array; /** * Get header. * * @return HeaderAbstract * * @since 1.0.0 */ public function getHeader() : HeaderAbstract { return $this->header; } /** * Get response body. * * @param bool $optimize Optimize response / minify * * @return string * * @since 1.0.0 */ abstract public function getBody(bool $optimize = false) : string; }