public function getDuration() { if (!$this->isFinished()) { throw new \LogicException('Cannot return duration: unit not finished.'); } return $this->finishedAt->diff($this->startedAt); }