keyed by busProId */ public function getAll(): array { return $this->cache->get( self::CACHE_KEY, self::TTL, fn (): array => $this->responseMapper->mapHotels($this->apiClient->get('api/hotels')), ); } public function get(int $busProId): ?Hotel { return $this->getAll()[$busProId] ?? null; } /** * @return list */ public function findByCode(string $code): array { $hotels = []; foreach ($this->getAll() as $hotel) { $hotelCode = $hotel->getCode(); if (null === $hotelCode) { continue; } if (str_starts_with($hotelCode, $code) || str_ends_with($hotelCode, $code)) { $hotels[] = $hotel; } } return $hotels; } }