ensureOpen(); $this->machineId = $machineId; $this->plannedOn = $plannedOn; $this->position = $position; } public function moveTo(int $position): void { $this->position = $position; } /** * @param int|null $userId Null when the task was marked done elsewhere. * * @throws QueueEntryCompleted */ public function complete(?int $userId, DateTimeImmutable $at): void { $this->ensureOpen(); $this->completedBy = $userId; $this->completedAt = $at; } /** * @throws QueueEntryCompleted */ public function ensureOpen(): void { if ($this->completedAt !== null) { throw new QueueEntryCompleted; } } public function isOrderLine(): bool { return $this->orderLineId !== null; } public function id(): ?int { return $this->id; } public function machineId(): int { return $this->machineId; } public function plannedOn(): DateTimeImmutable { return $this->plannedOn; } public function position(): int { return $this->position; } public function taskId(): ?int { return $this->taskId; } public function orderLineId(): ?int { return $this->orderLineId; } public function stepPosition(): ?int { return $this->stepPosition; } public function completedAt(): ?DateTimeImmutable { return $this->completedAt; } public function completedBy(): ?int { return $this->completedBy; } }