Files
jianfeng-server/vendor/topthink/think-swoole/src/resetters/ResetEvent.php
2025-10-02 10:33:06 +08:00

33 lines
627 B
PHP
Executable File

<?php
namespace think\swoole\resetters;
use think\Container;
use think\swoole\Sandbox;
use think\swoole\contract\ResetterInterface;
/**
* Class ResetEvent
* @package think\swoole\resetters
* @property Container $app;
*/
class ResetEvent implements ResetterInterface
{
public function handle(Container $app, Sandbox $sandbox)
{
$event = clone $sandbox->getEvent();
$closure = function () use ($app) {
$this->app = $app;
};
$resetEvent = $closure->bindTo($event, $event);
$resetEvent();
$app->instance('event', $event);
return $app;
}
}