Tip-Top API
Class

Neutron\TipTop\Clock

class Clock extends EventEmitter

Methods

__construct(Pulse $pulse = null)

Timers getTimers()

Clock setTimers(Timers $timers)

Clock destroy()

Clock pause()

Clock resume()

Boolean isPaused()

block()

TimerInterface addTimer(integer $interval, callable $callback)

TimerInterface addPeriodicTimer(integer $interval, callable $callback, integer $iterations = INF)

clear(TimerInterface $timer)

Alias for cancelTimer

Clock cancelTimer(TimerInterface $timer)

Stops the given timer.

Clock cancelTimers()

Boolean isTimerActive(TimerInterface $timer)

Returns true if the timer is active.

tick()

Internal method for the heartbeat, should not be used.

Details

at line 30
public __construct(Pulse $pulse = null)

Parameters

Pulse $pulse

at line 41
public Timers getTimers()

Return Value

Timers

at line 51
public Clock setTimers(Timers $timers)

Parameters

Timers $timers

Return Value

Clock

at line 65
public Clock destroy()

Return Value

Clock

at line 82
public Clock pause()

Return Value

Clock

at line 98
public Clock resume()

Return Value

Clock

at line 112
public Boolean isPaused()

Return Value

Boolean

at line 125
public block()

at line 142
public TimerInterface addTimer(integer $interval, callable $callback)

Parameters

integer $interval The interval of the timer in seconds
callable $callback Any callable

Return Value

TimerInterface The timer

at line 161
public TimerInterface addPeriodicTimer(integer $interval, callable $callback, integer $iterations = INF)

Parameters

integer $interval The interval of the timer in seconds
callable $callback Any callable
integer $iterations The number of time the callback must be triggered, infinite by default

Return Value

TimerInterface The timer

at line 174
public clear(TimerInterface $timer)

Alias for cancelTimer

Parameters

TimerInterface $timer

at line 188
public Clock cancelTimer(TimerInterface $timer)

Stops the given timer.

Parameters

TimerInterface $timer

Return Value

Clock

at line 202
public Clock cancelTimers()

Return Value

Clock

at line 216
public Boolean isTimerActive(TimerInterface $timer)

Returns true if the timer is active.

Parameters

TimerInterface $timer

Return Value

Boolean

at line 224
public tick()

Internal method for the heartbeat, should not be used.