diff --git a/src/Service/ParcelShopsService.php b/src/Service/ParcelShopsService.php index bc473c2..35e1799 100644 --- a/src/Service/ParcelShopsService.php +++ b/src/Service/ParcelShopsService.php @@ -49,7 +49,11 @@ public function getParcelShopCollection( $parcelShopCollection = []; foreach ($rawParcelShopCollection as $rawParcelShop) { - $openings = $this->getOpenings($rawParcelShop->pclshopid); + try { + $openings = $this->getOpenings($rawParcelShop->pclshopid); + } catch (\Throwable $throwable) { + $openings = []; + } $parcelShop = ParcelShop::fromRawParcelShop($rawParcelShop, $openings); $parcelShopCollection[] = $parcelShop; @@ -102,10 +106,6 @@ public function getOpenings(string $shopId): array ); $response = $this->client->request($request); - try { - return $this->serializer->decodeResponse(sprintf('%s[]', Openings::class), $response); - } catch (\Throwable $throwable) { - return []; - } + return $this->serializer->decodeResponse(sprintf('%s[]', Openings::class), $response); } }