innmind/time-warp

时间扭曲

3.0.0 2022-02-06 10:27 UTC

This package is auto-updated.

Last update: 2024-09-06 15:38:06 UTC


README

Build Status codecov Type Coverage

一个小型库,用于抽象程序挂起的方式。

目前这个库只能在地球上使用,请勿在火星或其他宇宙中任何地方使用。

安装

composer require innmind/time-warp

用法

use Innmind\TimeWarp\{
    Halt\Usleep,
    Halt,
};
use Innmind\TimeContinuum\Earth\Period\Minute;

function yourApp(Halt $halt): void
{
    // do something
    $halt(new Minute(42));
    // do some more
}

yourApp(new Usleep);

此示例将使您的程序停止42分钟。

日志记录

use Innmind\TimeWarp\Halt\Logger;
use Psr\Log\LoggerInterface;

$halt = Logger::psr($halt, /** an instance of LoggerInterface */);