This commit is contained in:
2020-12-24 11:12:23 +08:00
parent 5a7c7176dc
commit f18031c2c0
18 changed files with 39 additions and 39 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ use Exception;
use Snowflake\Abstracts\Component;
use Snowflake\Core\Help;
use Snowflake\Core\JSON;
use Snowflake\Core\Json;
use Swoole\Coroutine\System;
+2 -2
View File
@@ -8,7 +8,7 @@ use Exception;
use HttpServer\Http\Context;
use Snowflake\Abstracts\Component;
use Snowflake\Core\Help;
use Snowflake\Core\JSON;
use Snowflake\Core\Json;
use Swoole\Http2\Request;
use Swoole\Coroutine\Http2\Client as H2Client;
@@ -107,7 +107,7 @@ class Http2 extends Component
'accept-encoding' => 'gzip'
];
if (!is_string($params)) {
$params = JSON::encode($params);
$params = Json::encode($params);
}
Context::setContext($domain . $path, $req);
}
+2 -2
View File
@@ -10,7 +10,7 @@ use HttpServer\Exception\ExitException;
use HttpServer\Http\Request as HRequest;
use HttpServer\Http\Response as HResponse;
use ReflectionException;
use Snowflake\Core\JSON;
use Snowflake\Core\Json;
use Snowflake\Event;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\NotFindClassException;
@@ -68,7 +68,7 @@ class OnRequest extends Callback
$request = get_object_vars($request);
$logger->write(JSON::encode($request), 'request');
$logger->write(Json::encode($request), 'request');
}
}
+3 -3
View File
@@ -7,7 +7,7 @@ namespace HttpServer\Events\Utility;
use Closure;
use Exception;
use ReflectionException;
use Snowflake\Core\JSON;
use Snowflake\Core\Json;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake;
@@ -26,7 +26,7 @@ class DataResolve
public static function pack($unpack, $data)
{
if (empty($unpack)) {
$params = JSON::encode($data);
$params = Json::encode($data);
} else {
$params = self::callbackResolve($unpack, null, null, $data);
}
@@ -49,7 +49,7 @@ class DataResolve
public static function unpack($unpack, $address, $port, $data)
{
if (empty($unpack)) {
$params = JSON::decode($data);
$params = Json::decode($data);
} else {
$params = self::callbackResolve($unpack, $address, $port, $data);
}
+2 -2
View File
@@ -11,7 +11,7 @@ namespace HttpServer\Http\Formatter;
use Exception;
use Snowflake\Core\JSON;
use Snowflake\Core\Json;
use HttpServer\Application;
use Swoole\Http\Response;
use HttpServer\IInterface\IFormatter;
@@ -38,7 +38,7 @@ class HtmlFormatter extends Application implements IFormatter
public function send($context): static
{
if (!is_string($context)) {
$context = JSON::encode($context);
$context = Json::encode($context);
}
$this->data = $context;
return $this;
+4 -4
View File
@@ -12,7 +12,7 @@ namespace HttpServer\Http;
use Exception;
use HttpServer\Exception\RequestException;
use Snowflake\Core\Help;
use Snowflake\Core\JSON;
use Snowflake\Core\Json;
use Snowflake\Snowflake;
/**
@@ -130,11 +130,11 @@ class HttpParams
{
$data = $this->array($name);
if (empty($data)) {
return JSON::encode([]);
return Json::encode([]);
} else if (!is_array($data)) {
return JSON::encode([]);
return Json::encode([]);
}
return JSON::encode($data);
return Json::encode($data);
}
/**
+2 -2
View File
@@ -8,7 +8,7 @@ use HttpServer\Application;
use HttpServer\IInterface\AuthIdentity;
use ReflectionException;
use Snowflake\Core\JSON;
use Snowflake\Core\Json;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake;
@@ -415,7 +415,7 @@ class Request extends Application
*/
public function isNotFound(): bool
{
return JSON::to(404, 'Page ' . $this->getUri() . ' not found.');
return Json::to(404, 'Page ' . $this->getUri() . ' not found.');
}
+2 -2
View File
@@ -11,7 +11,7 @@ use Exception;
use HttpServer\Application;
use ReflectionException;
use Snowflake\Core\JSON;
use Snowflake\Core\Json;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake;
use Swoole\Coroutine;
@@ -440,7 +440,7 @@ class Node extends Application
{
$this->restructure();
if (empty($this->callback)) {
return JSON::to(404, $node->_error ?? 'Page not found.');
return Json::to(404, $node->_error ?? 'Page not found.');
}
$requestParams = func_get_args();
if (func_num_args() > 0) {
+4 -4
View File
@@ -37,10 +37,10 @@ return [
],
'message' => [
'pack' => function ($data) {
return \Snowflake\Core\JSON::encode($data);
return \Snowflake\Core\Json::encode($data);
},
'unpack' => function ($data) {
return \Snowflake\Core\JSON::decode($data);
return \Snowflake\Core\Json::decode($data);
},
],
'events' => [
@@ -57,10 +57,10 @@ return [
],
'message' => [
'pack' => function ($data) {
return \Snowflake\Core\JSON::encode($data);
return \Snowflake\Core\Json::encode($data);
},
'unpack' => function ($data) {
return \Snowflake\Core\JSON::decode($data);
return \Snowflake\Core\Json::decode($data);
},
],
'events' => [