Skip to content

Commit 340aacf

Browse files
committed
Get cities response method
1 parent f1d5863 commit 340aacf

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/Command/AbstractCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Answear\MwlBundle\Command;
66

77
use Answear\MwlBundle\Client\Client;
8+
use Answear\MwlBundle\Request\Request;
89
use Psr\Http\Message\ResponseInterface;
910
use Webmozart\Assert\Assert;
1011

@@ -14,6 +15,11 @@ public function __construct(protected Client $client)
1415
{
1516
}
1617

18+
public function getResponse(Request $request): ResponseInterface
19+
{
20+
return $this->client->request($request);
21+
}
22+
1723
protected function getBody(ResponseInterface $response): array
1824
{
1925
$body = $response->getBody()->getContents();

src/Command/GetCities.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44

55
namespace Answear\MwlBundle\Command;
66

7-
use Answear\MwlBundle\Client\Client;
87
use Answear\MwlBundle\Request\GetCitiesRequest;
98
use Answear\MwlBundle\Response\GetCitiesResponse;
109

1110
readonly class GetCities extends AbstractCommand
1211
{
1312
public function getCities(GetCitiesRequest $request): GetCitiesResponse
1413
{
15-
$response = $this->client->request($request);
14+
$response = $this->getResponse($request);
1615

1716
return GetCitiesResponse::fromArray(
1817
$this->getBody($response),

src/Command/GetPickupPoints.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{
1212
public function getPickupPoints(GetPickupPointsRequest $request): GetPickupPointsResponse
1313
{
14-
$response = $this->client->request($request);
14+
$response = $this->getResponse($request);
1515

1616
return GetPickupPointsResponse::fromArray(
1717
$this->getBody($response),

src/Command/GetPickupPointsByCarriersAndCountryCodes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{
1212
public function getPickupPointsByCarriersAndCountryCodesRequest(GetPickupPointsByCarriersAndCountryCodesRequest $request): GetPickupPointsResponse
1313
{
14-
$response = $this->client->request($request);
14+
$response = $this->getResponse($request);
1515

1616
return GetPickupPointsResponse::fromArray(
1717
$this->getBody($response),

0 commit comments

Comments
 (0)