diff --git a/Message/Cli/CliResponse.php b/Message/Cli/CliResponse.php index dcee7a9b7..640a44cc8 100755 --- a/Message/Cli/CliResponse.php +++ b/Message/Cli/CliResponse.php @@ -65,7 +65,7 @@ final class CliResponse extends ResponseAbstract implements RenderableInterface */ public function setResponse(array $response) : void { - $this->response = $response; + $this->data = $response; } /** @@ -79,8 +79,8 @@ final class CliResponse extends ResponseAbstract implements RenderableInterface */ public function remove(string $id) : bool { - if (isset($this->response[$id])) { - unset($this->response[$id]); + if (isset($this->data[$id])) { + unset($this->data[$id]); return true; } @@ -134,7 +134,7 @@ final class CliResponse extends ResponseAbstract implements RenderableInterface { $render = ''; - foreach ($this->response as $response) { + foreach ($this->data as $response) { $render .= StringUtils::stringify($response); } @@ -148,7 +148,7 @@ final class CliResponse extends ResponseAbstract implements RenderableInterface { $result = []; - foreach ($this->response as $response) { + foreach ($this->data as $response) { if ($response instanceof View) { $result[] = $response->toArray(); } elseif (\is_array($response) || \is_scalar($response)) { diff --git a/Message/Http/HttpResponse.php b/Message/Http/HttpResponse.php index 2995813ea..f8a6c50c3 100755 --- a/Message/Http/HttpResponse.php +++ b/Message/Http/HttpResponse.php @@ -59,7 +59,7 @@ final class HttpResponse extends ResponseAbstract implements RenderableInterface */ public function setResponse(array $response) : void { - $this->response = $response; + $this->data = $response; } /** @@ -73,8 +73,8 @@ final class HttpResponse extends ResponseAbstract implements RenderableInterface */ public function remove(string $id) : bool { - if (isset($this->response[$id])) { - unset($this->response[$id]); + if (isset($this->data[$id])) { + unset($this->data[$id]); return true; } @@ -143,7 +143,7 @@ final class HttpResponse extends ResponseAbstract implements RenderableInterface private function getRaw(bool $optimize = false) : string { $render = ''; - foreach ($this->response as $response) { + foreach ($this->data as $response) { // @note: Api functions return void -> null, this is where the null value is "ignored"/rendered as '' $render .= StringUtils::stringify($response); } @@ -183,7 +183,7 @@ final class HttpResponse extends ResponseAbstract implements RenderableInterface { $result = []; - foreach ($this->response as $response) { + foreach ($this->data as $response) { if ($response instanceof View) { $result[] = $response->toArray(); } elseif (\is_array($response) || \is_scalar($response)) { diff --git a/Message/RequestAbstract.php b/Message/RequestAbstract.php index 246863c02..aeadb4e62 100755 --- a/Message/RequestAbstract.php +++ b/Message/RequestAbstract.php @@ -40,7 +40,7 @@ abstract class RequestAbstract implements MessageInterface * @var array * @since 1.0.0 */ - protected array $data = []; + public array $data = []; /** * Files data. @@ -48,7 +48,7 @@ abstract class RequestAbstract implements MessageInterface * @var array * @since 1.0.0 */ - protected array $files = []; + public array $files = []; /** * Request lock. diff --git a/Message/ResponseAbstract.php b/Message/ResponseAbstract.php index 0d109152f..aa886fb80 100755 --- a/Message/ResponseAbstract.php +++ b/Message/ResponseAbstract.php @@ -32,7 +32,7 @@ abstract class ResponseAbstract implements \JsonSerializable, MessageInterface * @var array * @since 1.0.0 */ - protected array $response = []; + public array $data = []; /** * Header. @@ -53,7 +53,7 @@ abstract class ResponseAbstract implements \JsonSerializable, MessageInterface */ public function get(mixed $id) : mixed { - return $this->response[$id] ?? null; + return $this->data[$id] ?? null; } /** @@ -69,9 +69,7 @@ abstract class ResponseAbstract implements \JsonSerializable, MessageInterface */ public function set(mixed $key, mixed $response, bool $overwrite = false) : 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; + $this->data[$key] = $response; } /** diff --git a/Message/Socket/SocketResponse.php b/Message/Socket/SocketResponse.php index 2dd4b85a9..16d30ddfd 100755 --- a/Message/Socket/SocketResponse.php +++ b/Message/Socket/SocketResponse.php @@ -42,7 +42,7 @@ final class SocketResponse extends ResponseAbstract implements RenderableInterfa */ public function setResponse(array $response) : void { - $this->response = $response; + $this->data = $response; } /** @@ -56,8 +56,8 @@ final class SocketResponse extends ResponseAbstract implements RenderableInterfa */ public function remove($id) : bool { - if (isset($this->response[$id])) { - unset($this->response[$id]); + if (isset($this->data[$id])) { + unset($this->data[$id]); return true; } @@ -118,7 +118,7 @@ final class SocketResponse extends ResponseAbstract implements RenderableInterfa { $render = ''; - foreach ($this->response as $key => $response) { + foreach ($this->data as $key => $response) { $render .= StringUtils::stringify($response); } @@ -157,7 +157,7 @@ final class SocketResponse extends ResponseAbstract implements RenderableInterfa { $result = []; - foreach ($this->response as $response) { + foreach ($this->data as $response) { if ($response instanceof View) { $result[] = $response->toArray(); } elseif (\is_array($response) || \is_scalar($response)) { diff --git a/Module/ModuleAbstract.php b/Module/ModuleAbstract.php index 0f1e792a3..f8ad6103b 100755 --- a/Module/ModuleAbstract.php +++ b/Module/ModuleAbstract.php @@ -220,12 +220,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => $status, 'title' => $title, 'message' => $message, 'response' => $obj, - ]); + ]; } /** @@ -246,12 +246,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::OK, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SuccessfulCreate'), 'response' => $obj, - ]); + ]; } /** @@ -272,12 +272,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::OK, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SuccessfulUpdate'), 'response' => $obj, - ]); + ]; } /** @@ -298,12 +298,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::OK, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SuccessfulDelete'), 'response' => $obj, - ]); + ]; } /** @@ -324,12 +324,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::OK, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SuccessfulRemove'), 'response' => $obj, - ]); + ]; } /** @@ -350,12 +350,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::OK, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SuccessfulReturn'), 'response' => $obj, - ]); + ]; } /** @@ -376,12 +376,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::OK, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SuccessfulAdd'), 'response' => $obj, - ]); + ]; } /** @@ -402,12 +402,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::WARNING, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'InvalidCreate'), 'response' => $obj, - ]); + ]; } /** @@ -428,12 +428,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::WARNING, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'InvalidUpdate'), 'response' => $obj, - ]); + ]; } /** @@ -454,12 +454,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::WARNING, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'InvalidDelete'), 'response' => $obj, - ]); + ]; } /** @@ -480,12 +480,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::WARNING, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'InvalidRemove'), 'response' => $obj, - ]); + ]; } /** @@ -506,12 +506,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::WARNING, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'InvalidReturn'), 'response' => $obj, - ]); + ]; } /** @@ -532,12 +532,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::WARNING, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'InvalidAdd'), 'response' => $obj, - ]); + ]; } /** @@ -558,12 +558,12 @@ abstract class ModuleAbstract ) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), [ + $response->data[$request->uri->__toString()] = [ 'status' => NotificationLevel::WARNING, 'title' => '', 'message' => $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'InvalidPermission'), 'response' => $obj, - ]); + ]; } /** @@ -580,7 +580,7 @@ abstract class ModuleAbstract protected function fillJsonRawResponse(RequestAbstract $request, ResponseAbstract $response, mixed $obj) : void { $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), $obj); + $response->data[$request->uri->__toString()] = $obj); } /**