Skip to content

Commit

Permalink
Merge pull request #5 from igormukhingmailcom-forks/fix-exception
Browse files Browse the repository at this point in the history
Fixed: Trying to get property 'PakkeshopData' of non-object
  • Loading branch information
igormukhingmailcom committed Aug 14, 2020
2 parents cbd2be5 + e4f425a commit cedb09f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Client/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ public function getAllParcelShops(string $countryCode): array
}

$parcelShops = [];
foreach ($result->GetAllParcelShopsResult->PakkeshopData as $parcelShop) {
$parcelShops[] = ParcelShop::createFromStdClass($parcelShop);
foreach ($result->GetAllParcelShopsResult as $parcelShopsResult) {
if (!isset($parcelShopsResult->PakkeshopData)) {
continue;
}

foreach ($parcelShopsResult->PakkeshopData as $parcelShop) {
$parcelShops[] = ParcelShop::createFromStdClass($parcelShop);
}
}

return $parcelShops;
Expand Down

0 comments on commit cedb09f

Please sign in to comment.