Files
kiri-http-server/Abstracts/DoWhile.php
T
2023-04-03 11:08:10 +08:00

37 lines
432 B
PHP

<?php
namespace Kiri\Server\Abstracts;
use Kiri\Di\Context;
class DoWhile
{
private bool $isStop = false;
/**
* @param array|\Closure $handler
* @return void
*/
public static function waite(array|\Closure $handler): void
{
if (Context::exists('stop')) {
return;
}
$handler();
self::waite($handler);
}
/**
* @return void
*/
public static function stop(): void
{
Context::set('stop', 1);
}
}