- class
Timer(php\time\Timer) - package
std - source
php/time/Timer.php
Description
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): TimerRun 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): TimerRun every time based on the period as in after() method.
Timer::trigger(callable $trigger, callable $callback, int $checkPeriod): TimerCreate trigger timer which once call when trigger callback will return true.
Timer::setTimeout(callable $taskCallback, int $millis): TimerLike in JS.
Timer::setInterval(callable $taskCallback, int $millis): TimerLike in JS.
Timer::sleep(string $period): voidSleep period time.
Timer::cancelAll(): voidCall all timer tasks which scheduled.
Timer::shutdownAll(): voidShutdown all timers and timer system!
Timer::parsePeriod(string $value): intConverts 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(): voidTimer constructor.
cancel(): voidCancel timer task.
run(): voidRun timer task.
scheduledTime(): voidReturns 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.)