hotelCode = $hotelCode; } public function getId(): ?int { return $this->id; } public function getHotelCode(): ?string { return $this->hotelCode; } public function getAccommodation(): ?Accommodation { return $this->accommodation; } public function setAccommodation(?Accommodation $accommodation): self { $this->accommodation = $accommodation; return $this; } public function getChangedAt(): ?\DateTimeImmutable { return $this->changedAt; } public function setChangedAt(?\DateTimeImmutable $changedAt): self { $this->changedAt = $changedAt; return $this; } public function getSyncedAt(): ?\DateTimeImmutable { return $this->syncedAt; } public function setSyncedAt(?\DateTimeImmutable $syncedAt): self { $this->syncedAt = $syncedAt; return $this; } public function getHorizonTo(): ?\DateTimeImmutable { return $this->horizonTo; } public function setHorizonTo(?\DateTimeImmutable $horizonTo): self { $this->horizonTo = $horizonTo; return $this; } public function getLastError(): ?string { return $this->lastError; } public function setLastError(?string $lastError): self { $this->lastError = $lastError; return $this; } public function getFailureCount(): int { return $this->failureCount; } public function setFailureCount(int $failureCount): self { $this->failureCount = $failureCount; return $this; } public function recordFailure(string $error): self { $this->lastError = $error; ++$this->failureCount; return $this; } /** * Records a successful sync of a window ending at $horizonTo. * * The horizon only ever grows, so an ad-hoc run over a narrow window — say * `--horizon-months=1` while debugging — cannot discard the reach the scheduled full sync * established. */ public function recordSuccess(\DateTimeImmutable $syncedAt, \DateTimeImmutable $horizonTo): self { $this->syncedAt = $syncedAt; $this->horizonTo = null === $this->horizonTo || $horizonTo > $this->horizonTo ? $horizonTo : $this->horizonTo; $this->lastError = null; $this->failureCount = 0; return $this; } }