- класс
Timer
(php\time\Timer
) - пакет
std
- исходники
php/time/Timer.php
Описание
Class Timer
Timer ::
after()
- Run once after the period in format:Timer ::
every()
- Run every time based on the period as in after() method.Timer ::
trigger()
- Create trigger timer which once call when trigger callback will return true.Timer ::
setTimeout()
- Like in JS.Timer ::
setInterval()
- Like in JS.Timer ::
sleep()
- Sleep period time.Timer ::
cancelAll()
- Call all timer tasks which scheduled.Timer ::
shutdownAll()
- Shutdown all timers and timer system!Timer ::
parsePeriod()
- Converts a string period to amount of millis.
->
__construct()
- Timer constructor.->
cancel()
- Cancel timer task.->
run()
- Run timer task.->
scheduledTime()
- Returns the scheduled execution time of the most recent
Timer::after(string $period, callable $callback): Timer
Run once after the period in format: '' - millis 's' - seconds 'm' - minutes 'h' - hours 'd' - days (24 hours)
for example '2h 30m 10s' or '2.5s' or '2000' or '1m 30s'
Timer::every(string $period, callable $callback): Timer
Run every time based on the period as in after() method.
Timer::trigger(callable $trigger, callable $callback, int $checkPeriod): Timer
Create trigger timer which once call when trigger callback will return true.
Timer::setTimeout(callable $taskCallback, int $millis): Timer
Like in JS.
Timer::setInterval(callable $taskCallback, int $millis): Timer
Like in JS.
Timer::sleep(string $period): void
Sleep period time.
Timer::cancelAll(): void
Call all timer tasks which scheduled.
Timer::shutdownAll(): void
Shutdown all timers and timer system!
Timer::parsePeriod(string $value): int
Converts a string period to amount of millis.
'' - millis 's' - seconds 'm' - minutes 'h' - hours 'd' - days (24 hours)
for example '2h 30m 10s' or '2.5s' or '2000' or '1m 30s'
__construct(): void
Timer constructor.
cancel(): void
Cancel timer task.
run(): void
Run timer task.
scheduledTime(): void
Returns the scheduled execution time of the most recent actual execution of this task. (If this method is invoked while task execution is in progress, the return value is the scheduled execution time of the ongoing task execution.)