src/Client/Product/CategoryParser.php 1 location
|
@@ 15-25 (lines=11) @@
|
| 12 |
|
|
| 13 |
|
final class CategoryParser |
| 14 |
|
{ |
| 15 |
|
public static function createFromResponse(ResponseInterface $response): array |
| 16 |
|
{ |
| 17 |
|
$categories = []; |
| 18 |
|
$data = json_decode($response->getBody()->getContents(), true); |
| 19 |
|
|
| 20 |
|
foreach ($data as $category) { |
| 21 |
|
$categories[] = self::createFromArray($category); |
| 22 |
|
} |
| 23 |
|
|
| 24 |
|
return $categories; |
| 25 |
|
} |
| 26 |
|
|
| 27 |
|
public static function parseArray($categories) |
| 28 |
|
{ |
src/Client/Product/DiscountParser.php 1 location
|
@@ 18-28 (lines=11) @@
|
| 15 |
|
|
| 16 |
|
final class DiscountParser |
| 17 |
|
{ |
| 18 |
|
public static function createFromResponse(ResponseInterface $response): array |
| 19 |
|
{ |
| 20 |
|
$products = []; |
| 21 |
|
$data = json_decode($response->getBody()->getContents(), true); |
| 22 |
|
|
| 23 |
|
foreach ($data as $product) { |
| 24 |
|
$products[] = self::parse($product); |
| 25 |
|
} |
| 26 |
|
|
| 27 |
|
return $products; |
| 28 |
|
} |
| 29 |
|
|
| 30 |
|
public static function parseArray($discounts): DiscountCollection |
| 31 |
|
{ |
src/Client/Product/ProductParser.php 1 location
|
@@ 16-26 (lines=11) @@
|
| 13 |
|
|
| 14 |
|
final class ProductParser |
| 15 |
|
{ |
| 16 |
|
public static function createFromResponse(ResponseInterface $response): array |
| 17 |
|
{ |
| 18 |
|
$products = []; |
| 19 |
|
$data = json_decode($response->getBody()->getContents(), true); |
| 20 |
|
|
| 21 |
|
foreach ($data as $purchase) { |
| 22 |
|
$products[] = self::parse($purchase); |
| 23 |
|
} |
| 24 |
|
|
| 25 |
|
return $products; |
| 26 |
|
} |
| 27 |
|
|
| 28 |
|
public static function parseArray(array $products): ProductCollection |
| 29 |
|
{ |