class Section

Stopwatch section.

Methods

__construct(float $origin = null, bool $morePrecision = false)

No description

Section|null
get(string $id)

Returns the child section.

open(string|null $id)

Creates or re-opens a child section.

string
getId()

No description

$this
setId(string $id)

Sets the session identifier.

startEvent(string $name, string $category)

Starts an event.

bool
isEventStarted(string $name)

Checks if the event was started.

stopEvent(string $name)

Stops an event.

lap(string $name)

Stops then restarts an event.

getEvent(string $name)

Returns a specific event by name.

getEvents()

Returns the events from this section.

Details

at line 50
__construct(float $origin = null, bool $morePrecision = false)

Parameters

float $origin Set the origin of the events in this section, use null to set their origin to their start time
bool $morePrecision If true, time is stored as float to keep the original microsecond precision

at line 63
Section|null get(string $id)

Returns the child section.

Parameters

string $id The child section identifier

Return Value

Section|null The child section or null when none found

at line 79
Section open(string|null $id)

Creates or re-opens a child section.

Parameters

string|null $id Null to create a new section, the identifier to re-open an existing one

Return Value

Section

at line 91
string getId()

Return Value

string The identifier of the section

at line 103
$this setId(string $id)

Sets the session identifier.

Parameters

string $id The session identifier

Return Value

$this

at line 118
StopwatchEvent startEvent(string $name, string $category)

Starts an event.

Parameters

string $name The event name
string $category The event category

Return Value

StopwatchEvent The event

at line 134
bool isEventStarted(string $name)

Checks if the event was started.

Parameters

string $name The event name

Return Value

bool

at line 148
StopwatchEvent stopEvent(string $name)

Stops an event.

Parameters

string $name The event name

Return Value

StopwatchEvent The event

Exceptions

LogicException When the event has not been started

at line 166
StopwatchEvent lap(string $name)

Stops then restarts an event.

Parameters

string $name The event name

Return Value

StopwatchEvent The event

Exceptions

LogicException When the event has not been started

at line 180
StopwatchEvent getEvent(string $name)

Returns a specific event by name.

Parameters

string $name The event name

Return Value

StopwatchEvent The event

Exceptions

LogicException When the event is not known

at line 194
StopwatchEvent[] getEvents()

Returns the events from this section.

Return Value

StopwatchEvent[] An array of StopwatchEvent instances