Files
kiri-http-server/Abstracts/DoWhile.php
T
2022-06-16 17:38:22 +08:00

37 lines
440 B
PHP

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