Files
crm/vendor/workerman/webman-framework/src/Context.php
T

24 lines
521 B
PHP
Raw Normal View History

2025-03-11 13:34:12 +08:00
<?php
namespace Webman;
use Workerman\Coroutine\Context as WorkermanContext;
use Workerman\Coroutine\Utils\DestructionWatcher;
use Closure;
/**
* Class Context
* @package Webman
*/
class Context extends WorkermanContext
{
public static function onDestroy(Closure $closure): void
{
$obj = static::get('context.onDestroy');
if (!$obj) {
$obj = new \stdClass();
static::set('context.onDestroy', $obj);
}
DestructionWatcher::watch($obj, $closure);
}
}