Timer
in package
implements
ITimer
Class for performing stopwatch functions.
Table of Contents
Interfaces
- ITimer
- Stopwatch capabilities.
Properties
- $_laps : mixed
- $_maxTime : mixed
- $_startTime : mixed
- $_stopTime : mixed
Methods
- __construct() : mixed
- Timer constructor.
- execute() : mixed
- getElapsed() : int
- getLaps() : array<string|int, mixed>
- lap() : int
- reset() : mixed
- Reset all timer values.
- setMaxTime() : Timer
- start() : mixed
- Start the timer.
- stop() : mixed
- Stop the timer.
Properties
$_laps
private
mixed
$_laps
= []
$_maxTime
private
mixed
$_maxTime
= 0
$_startTime
private
mixed
$_startTime
= 0
$_stopTime
private
mixed
$_stopTime
= 0
Methods
__construct()
Timer constructor.
public
__construct([int $time = 0 ]) : mixed
Parameters
- $time : int = 0
-
used for testing purposes.
execute()
public
execute(mixed $function) : mixed
Parameters
- $function : mixed
getElapsed()
public
getElapsed() : int
Return values
int —Number of seconds elapsed .
getLaps()
public
getLaps() : array<string|int, mixed>
Return values
array<string|int, mixed>lap()
public
lap(string $name) : int
Parameters
- $name : string
Return values
intreset()
Reset all timer values.
public
reset() : mixed
setMaxTime()
public
setMaxTime(int $max) : Timer
Parameters
- $max : int
Return values
Timerstart()
Start the timer.
public
start() : mixed
stop()
Stop the timer.
public
stop() : mixed