Interval
in package
This object invokes the given callback within a new coroutine every $interval seconds until either the {@see self::disable()} method is called or the object is destroyed.
Table of Contents
Properties
- $callbackId : string
Methods
- __construct() : mixed
- __destruct() : mixed
- disable() : $this
- Stop the repeating timer. Restart it with {@see self::enable()}.
- enable() : $this
- Restart the repeating timer if previously stopped with {@see self::disable()}.
- isEnabled() : bool
- isReferenced() : bool
- reference() : $this
- References the internal event-loop callback, keeping the loop running while the repeat loop is enabled.
- unreference() : $this
- Unreferences the internal event-loop callback, allowing the loop to stop while the repeat loop is enabled.
Properties
$callbackId read-only
private
string
$callbackId
Methods
__construct()
public
__construct(float $interval, callable(): void $closure[, bool $reference = true ]) : mixed
Parameters
- $interval : float
-
Invoke the function every $interval seconds.
- $closure : callable(): void
-
Use weakClosure() to avoid a circular reference if storing this object as a property of another object.
- $reference : bool = true
-
If false, unreference the underlying event-loop callback.
__destruct()
public
__destruct() : mixed
disable()
Stop the repeating timer. Restart it with {@see self::enable()}.
public
disable() : $this
Return values
$thisenable()
Restart the repeating timer if previously stopped with {@see self::disable()}.
public
enable() : $this
Return values
$thisisEnabled()
public
isEnabled() : bool
Return values
bool —True if the repeating timer is enabled.
isReferenced()
public
isReferenced() : bool
Return values
bool —True if the internal event-loop callback is referenced.
reference()
References the internal event-loop callback, keeping the loop running while the repeat loop is enabled.
public
reference() : $this
Return values
$thisunreference()
Unreferences the internal event-loop callback, allowing the loop to stop while the repeat loop is enabled.
public
unreference() : $this