id = $id; $this->description = $description; $this->start = $start; } /** * @param float $time */ public function end($time) { $this->end = $time; } /** * @return float */ public function getStart() { return $this->start; } /** * @return string */ public function getId() { return $this->id; } /** * @return string */ public function getDescription() { return $this->description; } /** * @return float */ public function getEnd() { return $this->end; } /** * @return float */ public function getDuration() { if (!$this->end) { $this->end = microtime(true); } return $this->end - $this->start; } public function __toString(): string { return $this->getId() . ' ' . $this->getDescription() . ' ' . $this->getDuration(); } }