改名
This commit is contained in:
@@ -93,7 +93,7 @@ class HTTPServerListener extends Abstracts\Server
|
||||
public function onRequest(Request $request, Response $response)
|
||||
{
|
||||
try {
|
||||
// defer(fn() => fire(Event::SYSTEM_RESOURCE_RELEASES));
|
||||
defer(fn() => fire(Event::SYSTEM_RESOURCE_RELEASES));
|
||||
|
||||
[$request, $_] = [HRequest::create($request), HResponse::create($response)];
|
||||
if ($request->is('favicon.ico')) {
|
||||
|
||||
+5
-13
@@ -6,9 +6,7 @@ namespace Snowflake;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Snowflake\Abstracts\BaseObject;
|
||||
use Snowflake\Core\ArrayAccess;
|
||||
|
||||
/**
|
||||
* Class Event
|
||||
@@ -200,31 +198,25 @@ class Event extends BaseObject
|
||||
/**
|
||||
* @param $name
|
||||
* @param array $params
|
||||
* @param null $scope
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function dispatch($name, array $params = [], $scope = null): bool
|
||||
public function dispatch($name, array $params = []): bool
|
||||
{
|
||||
return static::trigger($name, $params, $scope);
|
||||
return static::trigger($name, $params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $parameter
|
||||
* @param null $handler
|
||||
* @param false $is_remove
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function trigger($name, $parameter = null, $handler = null, bool $is_remove = false): bool
|
||||
public static function trigger($name, $parameter = null, bool $is_remove = false): bool
|
||||
{
|
||||
$events = static::get($name, $handler);
|
||||
if (empty($events)) {
|
||||
return true;
|
||||
}
|
||||
foreach ($events as $event) {
|
||||
foreach ((static::$_events[$name] ?? []) as $event) {
|
||||
static::execute($event, $parameter);
|
||||
}
|
||||
if ($is_remove) {
|
||||
@@ -249,7 +241,7 @@ class Event extends BaseObject
|
||||
}
|
||||
return true;
|
||||
} catch (\Throwable $throwable) {
|
||||
return logger()->addError($throwable,'throwable');
|
||||
return logger()->addError($throwable, 'throwable');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user