<?php
 namespace Eluceo\iCal\Domain\ValueObject\Alarm; use DateInterval; final class RelativeTrigger extends Trigger { private bool $relatedToStart = true; private DateInterval $duration; public function __construct(DateInterval $duration) { $this->duration = $duration; } public function isRelatedToStart(): bool { return $this->relatedToStart; } public function isRelatedToEnd(): bool { return !$this->relatedToStart; } public function getDuration(): DateInterval { return $this->duration; } public function withRelationToEnd(): self { $new = clone $this; $new->relatedToStart = false; return $new; } public function withRelationToStart(): self { $new = clone $this; $new->relatedToStart = true; return $new; } } 