From 7f210e1d7725daaf262051c48c8a4136244cc430 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Sun, 25 Apr 2021 00:35:57 +0800 Subject: [PATCH] modify --- HttpServer/Http/Response.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/HttpServer/Http/Response.php b/HttpServer/Http/Response.php index d9522d57..4f6eda0b 100644 --- a/HttpServer/Http/Response.php +++ b/HttpServer/Http/Response.php @@ -179,14 +179,15 @@ class Response extends HttpService private function parseData($context): mixed { if ($context === null) { - return ''; + if (isset($this->_format_maps[$this->format])) { + $class['class'] = $this->_format_maps[$this->format]; + } else { + $class['class'] = HtmlFormatter::class; + } + $format = Snowflake::createObject($class); + return $format->send($context)->getData(); } - if (isset($this->_format_maps[$this->format])) { - $className = $this->_format_maps[$this->format]; - } else { - $className = HtmlFormatter::class; - } - return (new $className())->send($context)->getData(); + return $context; } /**