W3cubDocs

/Symfony 3.0

Symfony\Component\Stopwatch\Section

class Section

Stopwatch section.

Methods

__construct(float|null $origin = null)

Constructor.

Section|null get(string $id)

Returns the child section.

Section open(string|null $id)

Creates or re-opens a child section.

string getId()
Section setId(string $id)

Sets the session identifier.

StopwatchEvent startEvent(string $name, string $category)

Starts an event.

bool isEventStarted(string $name)

Checks if the event was started.

StopwatchEvent stopEvent(string $name)

Stops an event.

StopwatchEvent lap(string $name)

Stops then restarts an event.

StopwatchEvent getEvent(string $name)

Returns a specific event by name.

StopwatchEvent[] getEvents()

Returns the events from this section.

Details

public __construct(float|null $origin = null)

Constructor.

Parameters

float|null $origin Set the origin of the events in this section, use null to set their origin to their start time

public 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

public 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 A child section

public string getId()

Return Value

string The identifier of the section

public Section setId(string $id)

Sets the session identifier.

Parameters

string $id The session identifier

Return Value

Section The current section

public 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

public bool isEventStarted(string $name)

Checks if the event was started.

Parameters

string $name The event name

Return Value

bool

public 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

public 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

public 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

public StopwatchEvent[] getEvents()

Returns the events from this section.

Return Value

StopwatchEvent[] An array of StopwatchEvent instances

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Stopwatch/Section.html