innmind/time-warp

Time warp

3.0.0 2022-02-06 10:27 UTC

This package is auto-updated.

Last update: 2024-11-06 16:01:18 UTC


README

Build Status codecov Type Coverage

Small lib to abstract the way to halt the program.

Currently this library is only usable on Earth, DO NOT use it on Mars or anywhere else in the universe.

Installation

composer require innmind/time-warp

Usage

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);

This example will halt your program for 42 minutes.

Logging

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

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