$this->id =
$id;
return $this;
} /**
* Starts an event.
*/
public function startEvent(string
$name, ?string
$category): StopwatchEvent
{ if (!
isset($this->events
[$name])) { $this->events
[$name] =
new StopwatchEvent($this->origin ?:
microtime(true
) * 1000,
$category,
$this->morePrecision,
$name);
} return $this->events
[$name]->
start();
} /**
* Checks if the event was started.
*/
public function isEventStarted(string
$name): bool
{ return isset($this->events
[$name]) &&
$this->events
[$name]->
isStarted();
}