info = $info; } public function queueTime(): int { return $this?->info['waitTime'] ?? 0; } public function isOpen(): bool { $now = now()->setTimezone('Europe/Berlin'); $inOpeningHours = $now->between($this->opensAt(), $this->closesAt()); $rideOpen = $this->info['open']; if(!$rideOpen) { return false; } return $inOpeningHours; } public function closesAt(): Carbon { return Carbon::parse($this->info['closing'], 'Europe/Berlin'); } public function opensAt(): Carbon { return Carbon::parse($this->info['opening'], 'Europe/Berlin'); } public function hasTag(AttractionTypeTag $tag): bool { return in_array($tag, $this->tags); } public function getTagEmote(AttractionTypeTag $tag): AttractionTypeEmote { $emotes = collect(AttractionTypeEmote::cases()); $emote = $emotes->first(fn($emote) => $emote->name === $tag->name); return $emote; } public function getTags(): Collection { return collect($this->tags)->map(function ($tag) { return AttractionTypeTag::from($tag); }); } public function getTagDescription(AttractionTypeTag $tag): string { $descriptions = collect(AttractionTypeTagDescription::cases()); $description = $descriptions->first(fn($description) => $description->name === $tag->name); return $description->value; } public function toArray() { return [ 'id' => $this->id, 'poiNumber' => $this->poiNumber, 'poiNumberWinter' => $this->poiNumberWinter, 'category' => $this->category, 'tags' => $this->tags, 'area' => $this->area, 'seasons' => $this->seasons, 'title' => $this->title, 'description' => $this->description, 'entrance' => $this->entrance, 'titleImage' => $this->titleImage, ]; } }