Section
in package
Stopwatch section.
Tags
Table of Contents
Properties
- $children : array<string|int, Section>
- $events : array<string|int, StopwatchEvent>
- $id : string|null
- $morePrecision : bool
- $origin : float|null
Methods
- __construct() : mixed
- get() : self|null
- Returns the child section.
- getEvent() : StopwatchEvent
- Returns a specific event by name.
- getEvents() : array<string|int, StopwatchEvent>
- Returns the events from this section.
- getId() : string|null
- isEventStarted() : bool
- Checks if the event was started.
- lap() : StopwatchEvent
- Stops then restarts an event.
- open() : self
- Creates or re-opens a child section.
- setId() : $this
- Sets the session identifier.
- startEvent() : StopwatchEvent
- Starts an event.
- stopEvent() : StopwatchEvent
- Stops an event.
Properties
$children
private
array<string|int, Section>
$children
= []
$events
private
array<string|int, StopwatchEvent>
$events
= []
$id
private
string|null
$id
= null
$morePrecision
private
bool
$morePrecision
= false
$origin
private
float|null
$origin
= null
Methods
__construct()
public
__construct([float|null $origin = null ][, bool $morePrecision = false ]) : mixed
Parameters
- $origin : float|null = null
-
Set the origin of the events in this section, use null to set their origin to their start time
- $morePrecision : bool = false
-
If true, time is stored as float to keep the original microsecond precision
get()
Returns the child section.
public
get(string $id) : self|null
Parameters
- $id : string
Return values
self|nullgetEvent()
Returns a specific event by name.
public
getEvent(string $name) : StopwatchEvent
Parameters
- $name : string
Tags
Return values
StopwatchEventgetEvents()
Returns the events from this section.
public
getEvents() : array<string|int, StopwatchEvent>
Return values
array<string|int, StopwatchEvent>getId()
public
getId() : string|null
Return values
string|nullisEventStarted()
Checks if the event was started.
public
isEventStarted(string $name) : bool
Parameters
- $name : string
Return values
boollap()
Stops then restarts an event.
public
lap(string $name) : StopwatchEvent
Parameters
- $name : string
Tags
Return values
StopwatchEventopen()
Creates or re-opens a child section.
public
open(string|null $id) : self
Parameters
- $id : string|null
-
Null to create a new section, the identifier to re-open an existing one
Return values
selfsetId()
Sets the session identifier.
public
setId(string $id) : $this
Parameters
- $id : string
Return values
$thisstartEvent()
Starts an event.
public
startEvent(string $name, string|null $category) : StopwatchEvent
Parameters
- $name : string
- $category : string|null
Return values
StopwatchEventstopEvent()
Stops an event.
public
stopEvent(string $name) : StopwatchEvent
Parameters
- $name : string