改名
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
@@ -31,7 +31,7 @@ class OnClose extends Callback
|
||||
public function onHandler(Server $server, int $fd)
|
||||
{
|
||||
try {
|
||||
[$manager, $name] = $this->resovle($server, $fd);
|
||||
[$manager, $name] = $this->resolve($server, $fd);
|
||||
if ($manager !== null && !$manager->has($name)) {
|
||||
$manager->runWith($name, [$fd]);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class OnClose extends Callback
|
||||
* @return array|null
|
||||
* @throws Exception
|
||||
*/
|
||||
public function resovle($server, $fd)
|
||||
public function resolve($server, $fd)
|
||||
{
|
||||
if ($server instanceof WServer) {
|
||||
if (!$server->isEstablished($fd)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
@@ -20,12 +20,12 @@ class OnPacket extends Callback
|
||||
{
|
||||
|
||||
|
||||
/** @var Closure|array */
|
||||
public $unpack;
|
||||
/** @var Closure */
|
||||
public Closure $unpack;
|
||||
|
||||
|
||||
/** @var Closure|array */
|
||||
public $pack;
|
||||
/** @var Closure */
|
||||
public Closure $pack;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
@@ -20,12 +20,12 @@ class OnReceive extends Callback
|
||||
{
|
||||
|
||||
|
||||
/** @var Closure|array */
|
||||
public $unpack;
|
||||
/** @var Closure */
|
||||
public Closure $unpack;
|
||||
|
||||
|
||||
/** @var Closure|array */
|
||||
public $pack;
|
||||
/** @var Closure */
|
||||
public Closure $pack;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
use HttpServer\Abstracts\Callback;
|
||||
use HttpServer\IInterface\Task;
|
||||
use HttpServer\IInterface\Task as ITask;
|
||||
use Snowflake\Event;
|
||||
use Snowflake\Snowflake;
|
||||
@@ -40,10 +42,9 @@ class OnTask extends Callback
|
||||
* @param string $data
|
||||
*
|
||||
* @return mixed|void
|
||||
* @throws Exception
|
||||
* 异步任务
|
||||
* @throws Exception 异步任务
|
||||
*/
|
||||
public function onTask(Server $server, $task_id, $from_id, $data)
|
||||
public function onTask(Server $server, int $task_id, int $from_id, string $data)
|
||||
{
|
||||
$time = microtime(TRUE);
|
||||
if (empty($data)) {
|
||||
@@ -102,7 +103,7 @@ class OnTask extends Callback
|
||||
$finish['class'] = get_class($serialize);
|
||||
$finish['params'] = $params;
|
||||
$finish['status'] = 'success';
|
||||
$finish['info'] = $serialize->handler();
|
||||
$finish['info'] = $serialize->onHandler();
|
||||
} catch (\Throwable $exception) {
|
||||
$finish['status'] = 'error';
|
||||
$finish['info'] = $this->format($exception);
|
||||
@@ -119,7 +120,7 @@ class OnTask extends Callback
|
||||
* @param $data
|
||||
* @return ITask|null
|
||||
*/
|
||||
protected function before($data)
|
||||
protected function before($data): Task|null
|
||||
{
|
||||
if (empty($serialize = unserialize($data))) {
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
@@ -11,6 +11,10 @@ use Snowflake\Exception\ConfigException;
|
||||
use Swoole\Coroutine;
|
||||
use Swoole\Server;
|
||||
|
||||
/**
|
||||
* Class OnWorkerError
|
||||
* @package HttpServer\Events
|
||||
*/
|
||||
class OnWorkerError extends Callback
|
||||
{
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HttpServer\Events;
|
||||
|
||||
|
||||
use HttpServer\Abstracts\Callback;
|
||||
|
||||
/**
|
||||
* Class OnWorkerStop
|
||||
* @package HttpServer\Events
|
||||
*/
|
||||
class OnWorkerStop extends Callback
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user