改名
This commit is contained in:
@@ -23,7 +23,7 @@ use HttpServer\IInterface\IFormatter;
|
|||||||
class HtmlFormatter extends HttpService implements IFormatter
|
class HtmlFormatter extends HttpService implements IFormatter
|
||||||
{
|
{
|
||||||
|
|
||||||
public $data;
|
public mixed $data;
|
||||||
|
|
||||||
/** @var Response */
|
/** @var Response */
|
||||||
public Response $status;
|
public Response $status;
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ class Request extends HttpService
|
|||||||
$sRequest->params->setPosts($request->post ?? []);
|
$sRequest->params->setPosts($request->post ?? []);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sRequest->headers = new HttpHeaders(ArrayAccess::merge($request->server, $request->header));
|
$sRequest->headers = new HttpHeaders(array_merge($request->server, $request->header));
|
||||||
$sRequest->uri = $sRequest->headers->get('request_uri');
|
$sRequest->uri = $sRequest->headers->get('request_uri');
|
||||||
|
|
||||||
$sRequest->parseUri();
|
$sRequest->parseUri();
|
||||||
@@ -475,11 +475,11 @@ class Request extends HttpService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $frame
|
* @param $frame
|
||||||
* @param $route
|
* @param string $route
|
||||||
* @param string $event
|
* @param string $event
|
||||||
* @return Request
|
* @return Request
|
||||||
*/
|
*/
|
||||||
public static function socketQuery($frame, $event = Socket::MESSAGE, $route = 'event'): Request
|
public static function socketQuery($frame, string $event = Socket::MESSAGE, string $route = 'event'): Request
|
||||||
{
|
{
|
||||||
$sRequest = new Request();
|
$sRequest = new Request();
|
||||||
$sRequest->fd = $frame->fd;
|
$sRequest->fd = $frame->fd;
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class Response extends HttpService
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function send($context = '', int $statusCode = 200): mixed
|
public function send(string $context = '', int $statusCode = 200): mixed
|
||||||
{
|
{
|
||||||
$sendData = $this->parseData($context);
|
$sendData = $this->parseData($context);
|
||||||
|
|
||||||
@@ -192,19 +192,18 @@ class Response extends HttpService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $result
|
* @param $result
|
||||||
* @return string
|
* @return void
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function printResult($result): string
|
private function printResult($result): void
|
||||||
{
|
{
|
||||||
$result = Help::toString($result);
|
$result = Help::toString($result);
|
||||||
$string = PHP_EOL . 'Command Result: ' . PHP_EOL . PHP_EOL;
|
$string = PHP_EOL . 'Command Result: ' . PHP_EOL . PHP_EOL;
|
||||||
|
|
||||||
fire('CONSOLE_END');
|
fire('CONSOLE_END');
|
||||||
if (str_contains((string)$result, 'Event::rshutdown(): Event::wait()')) {
|
if (str_contains((string)$result, 'Event::rshutdown(): Event::wait()')) {
|
||||||
return (string)$result;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($result)) {
|
if (empty($result)) {
|
||||||
$string .= 'success!' . PHP_EOL . PHP_EOL;
|
$string .= 'success!' . PHP_EOL . PHP_EOL;
|
||||||
} else {
|
} else {
|
||||||
@@ -212,8 +211,6 @@ class Response extends HttpService
|
|||||||
}
|
}
|
||||||
$string .= 'Command End!' . PHP_EOL . PHP_EOL;
|
$string .= 'Command End!' . PHP_EOL . PHP_EOL;
|
||||||
print_r($string);
|
print_r($string);
|
||||||
|
|
||||||
return (string)$result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -297,7 +294,7 @@ class Response extends HttpService
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function close($statusCode = 200, $message = ''): mixed
|
public function close(int $statusCode = 200, string $message = ''): mixed
|
||||||
{
|
{
|
||||||
return $this->send($message, $statusCode);
|
return $this->send($message, $statusCode);
|
||||||
}
|
}
|
||||||
@@ -309,7 +306,7 @@ class Response extends HttpService
|
|||||||
* @param string $message
|
* @param string $message
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function closeClient($clientId, $statusCode = 200, $message = ''): mixed
|
public function closeClient($clientId,int $statusCode = 200,string $message = ''): mixed
|
||||||
{
|
{
|
||||||
$socket = Snowflake::getWebSocket();
|
$socket = Snowflake::getWebSocket();
|
||||||
if (!$socket->exist($clientId)) {
|
if (!$socket->exist($clientId)) {
|
||||||
@@ -326,7 +323,7 @@ class Response extends HttpService
|
|||||||
* @param int $sleep
|
* @param int $sleep
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function sendFile(string $path, $offset = 0, $limit = 1024000, $sleep = 0): string
|
public function sendFile(string $path, int $offset = 0, int $limit = 1024000, int $sleep = 0): string
|
||||||
{
|
{
|
||||||
$open = fopen($path, 'r');
|
$open = fopen($path, 'r');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user