uid = $uid; $this->utoken = $utoken; $this->updatedAt = new \DateTimeImmutable(); } public function getId(): ?int { return $this->id; } public function getUid(): string { return $this->uid; } public function getUtoken(): string { return $this->utoken; } public function getToys(): array { return $this->toys; } public function getPlatform(): ?string { return $this->platform; } public function getUpdatedAt(): \DateTimeImmutable { return $this->updatedAt; } public function updateFromCallback(string $utoken, array $toys, ?string $platform): static { $this->utoken = $utoken; $this->toys = $toys; $this->platform = $platform; $this->updatedAt = new \DateTimeImmutable(); return $this; } public function isOnline(): bool { foreach ($this->toys as $toy) { if (1 === (int) ($toy['status'] ?? 0)) { return true; } } return false; } }