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
+2 -2
View File
@@ -6,7 +6,7 @@ namespace Snowflake\Abstracts;
use Exception;
use HttpServer\Exception\ExitException;
use Snowflake\Core\JSON;
use Snowflake\Core\Json;
/**
* Class BaseGoto
@@ -23,7 +23,7 @@ class BaseGoto extends Component
*/
public function end(string $message, $statusCode = 200): mixed
{
throw new ExitException(JSON::to(12350, $message), $statusCode);
throw new ExitException(Json::to(12350, $message), $statusCode);
}
}
+1 -1
View File
@@ -93,7 +93,7 @@ class Help
if (!is_string($parameter)) {
$parameter = ArrayAccess::toArray($parameter);
if (is_array($parameter)) {
$parameter = JSON::encode($parameter);
$parameter = Json::encode($parameter);
}
}
return $parameter;
@@ -16,7 +16,7 @@ use Exception;
* Class JSON
* @package Snowflake\Snowflake\Core
*/
class JSON
class Json
{
/**
+3 -3
View File
@@ -12,7 +12,7 @@ namespace Snowflake\Error;
use Exception;
use HttpServer\IInterface\IFormatter;
use Snowflake\Abstracts\Component;
use Snowflake\Core\JSON;
use Snowflake\Core\Json;
use Snowflake\Event;
use Snowflake\Snowflake;
@@ -98,7 +98,7 @@ class ErrorHandler extends Component implements ErrorInterface
$error[0] = 500;
}
$data = JSON::to(500, $error[1], $path);
$data = Json::to(500, $error[1], $path);
logger()->error($data, 'error');
@@ -120,7 +120,7 @@ class ErrorHandler extends Component implements ErrorInterface
{
$path = ['file' => $file, 'line' => $line];
$data = JSON::to($code, $this->category . ': ' . $message, $path);
$data = Json::to($code, $this->category . ': ' . $message, $path);
logger()->trance($data, $this->category);
+2 -2
View File
@@ -12,7 +12,7 @@ namespace Snowflake\Error;
use Exception;
use Snowflake\Abstracts\Component;
use Snowflake\Abstracts\Config;
use Snowflake\Core\JSON;
use Snowflake\Core\Json;
use Snowflake\Snowflake;
use Swoole\Process;
use Throwable;
@@ -258,7 +258,7 @@ class Logger extends Component
$logger->write($string . $exception->getTraceAsString(), 'trace');
$logger->write(jTraceEx($exception), 'exception');
return JSON::to($code, $errorInfo['message'], [
return Json::to($code, $errorInfo['message'], [
'file' => $exception->getFile(),
'line' => $exception->getLine()
]);
+2 -2
View File
@@ -10,7 +10,7 @@ use HttpServer\IInterface\Task;
use ReflectionException;
use Snowflake\Abstracts\Config;
use Snowflake\Core\JSON;
use Snowflake\Core\Json;
use Snowflake\Di\Container;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\NotFindClassException;
@@ -257,7 +257,7 @@ class Snowflake
return false;
}
if (!is_string($data)) {
$data = JSON::encode($data);
$data = Json::encode($data);
}
return $server->push($fd, $data);
}