Documentation

Section
in package

Stopwatch section.

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

$children  : array<string|int, Section>
$events  : array<string|int, StopwatchEvent>
$id  : string
$morePrecision  : bool
$origin  : float|null
__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
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

$morePrecision

private bool $morePrecision

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

Return values
mixed

get()

Returns the child section.

public get(string $id) : self|null
Parameters
$id : string
Return values
self|null

getEvent()

Returns a specific event by name.

public getEvent(string $name) : StopwatchEvent
Parameters
$name : string
Tags
throws
LogicException

When the event is not known

Return values
StopwatchEvent

getId()

public getId() : string
Return values
string

isEventStarted()

Checks if the event was started.

public isEventStarted(string $name) : bool
Parameters
$name : string
Return values
bool

lap()

Stops then restarts an event.

public lap(string $name) : StopwatchEvent
Parameters
$name : string
Tags
throws
LogicException

When the event has not been started

Return values
StopwatchEvent

open()

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
self

setId()

Sets the session identifier.

public setId(string $id) : $this
Parameters
$id : string
Return values
$this

startEvent()

Starts an event.

public startEvent(string $name, string|null $category) : StopwatchEvent
Parameters
$name : string
$category : string|null
Return values
StopwatchEvent

stopEvent()

Stops an event.

public stopEvent(string $name) : StopwatchEvent
Parameters
$name : string
Tags
throws
LogicException

When the event has not been started

Return values
StopwatchEvent

Search results