Timer
class Timer
Constants
| STOP |
|
Methods
Create a new timer instance.
Execute a callback after a given timeout or when the identifier is resumed.
Execute a callback repeatedly at a given interval until stopped or the identifier is resumed.
Execute a callback when the identifier is resumed.
Clear a registered timer callback by its ID.
Clear all registered timer callbacks.
Get the current timer statistics.
Flush all static state.
Details
at line 44
__construct(LoggerInterface|null $logger = null)
Create a new timer instance.
at line 52
int
after(float $timeout, callable $closure, string $identifier = Constants::WORKER_EXIT)
Execute a callback after a given timeout or when the identifier is resumed.
at line 101
int
tick(float $timeout, callable $closure, string $identifier = Constants::WORKER_EXIT)
Execute a callback repeatedly at a given interval until stopped or the identifier is resumed.
at line 210
int
until(callable $closure, string $identifier = Constants::WORKER_EXIT)
Execute a callback when the identifier is resumed.
at line 218
void
clear(int $id)
Clear a registered timer callback by its ID.
at line 233
void
clearAll()
Clear all registered timer callbacks.
at line 245
static array
stats()
Get the current timer statistics.
at line 270
static void
flushState()
Flush all static state.