@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace AcquiroPay\Contracts; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace AcquiroPay\Contracts; |
6 | 6 | |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | |
20 | 20 | public function getProducts(array $params = []): Collection; |
21 | 21 | |
22 | - public function getCountry(int $id, array $params = []): ?Country; |
|
22 | + public function getCountry(int $id, array $params = []): ? Country; |
|
23 | 23 | |
24 | - public function getCurrency(int $id, array $params = []): ?Currency; |
|
24 | + public function getCurrency(int $id, array $params = []): ? Currency; |
|
25 | 25 | |
26 | - public function getProduct(int $id, array $params = []): ?Product; |
|
26 | + public function getProduct(int $id, array $params = []): ? Product; |
|
27 | 27 | |
28 | - public function getProductSite(int $productId, array $params = []): ?Site; |
|
28 | + public function getProductSite(int $productId, array $params = []): ? Site; |
|
29 | 29 | |
30 | - public function getProductMerchant(int $productId, array $params = []): ?Merchant; |
|
30 | + public function getProductMerchant(int $productId, array $params = []): ? Merchant; |
|
31 | 31 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace AcquiroPay\Services; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace AcquiroPay\Services; |
6 | 6 | |
@@ -47,32 +47,32 @@ discard block |
||
47 | 47 | return $this->getEntityCollection(Product::class, $params); |
48 | 48 | } |
49 | 49 | |
50 | - public function getCountry(int $id, array $params = []): ?Country |
|
50 | + public function getCountry(int $id, array $params = []): ? Country |
|
51 | 51 | { |
52 | 52 | return $this->getEntity(new Country(), $id, $params); |
53 | 53 | } |
54 | 54 | |
55 | - public function getCurrency(int $id, array $params = []): ?Currency |
|
55 | + public function getCurrency(int $id, array $params = []): ? Currency |
|
56 | 56 | { |
57 | 57 | return $this->getEntity(new Currency(), $id, $params); |
58 | 58 | } |
59 | 59 | |
60 | - public function getProduct(int $id, array $params = []): ?Product |
|
60 | + public function getProduct(int $id, array $params = []): ? Product |
|
61 | 61 | { |
62 | 62 | return $this->getEntity(new Product(), $id, $params); |
63 | 63 | } |
64 | 64 | |
65 | - public function getProductSite(int $productId, array $params = []): ?Site |
|
65 | + public function getProductSite(int $productId, array $params = []): ? Site |
|
66 | 66 | { |
67 | - $url = $this->resource(Product::class) . '/' . $productId . '/site'; |
|
67 | + $url = $this->resource(Product::class).'/'.$productId.'/site'; |
|
68 | 68 | $resp = $this->makeGetRequest($url, $params); |
69 | 69 | |
70 | 70 | return $this->response2Entity($resp, new Site()); |
71 | 71 | } |
72 | 72 | |
73 | - public function getProductMerchant(int $productId, array $params = []): ?Merchant |
|
73 | + public function getProductMerchant(int $productId, array $params = []): ? Merchant |
|
74 | 74 | { |
75 | - $url = $this->resource(Merchant::class) . '/' . $productId . '/merchant'; |
|
75 | + $url = $this->resource(Merchant::class).'/'.$productId.'/merchant'; |
|
76 | 76 | $resp = $this->makeGetRequest($url, $params); |
77 | 77 | |
78 | 78 | return $this->response2Entity($resp, new Merchant()); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | public function get(string $entityName, $id, array $params = []): stdClass |
89 | 89 | { |
90 | - $url = $this->resource($entityName) . '/' . $id; |
|
90 | + $url = $this->resource($entityName).'/'.$id; |
|
91 | 91 | |
92 | 92 | return $this->makeGetRequest($url, $params); |
93 | 93 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | return collect(); |
103 | 103 | } |
104 | 104 | |
105 | - protected function getEntity(Entity $entity, $id, array $params): ?Entity |
|
105 | + protected function getEntity(Entity $entity, $id, array $params): ? Entity |
|
106 | 106 | { |
107 | 107 | $resp = $this->get(get_class($entity), $id, $params); |
108 | 108 | |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | */ |
125 | 125 | protected function makeRequest(string $method, string $url, array $options) |
126 | 126 | { |
127 | - $response = $this->client->request($method, 'services/entities/' . $url, $options); |
|
128 | - $response = (string)$response->getBody()->getContents(); |
|
127 | + $response = $this->client->request($method, 'services/entities/'.$url, $options); |
|
128 | + $response = (string) $response->getBody()->getContents(); |
|
129 | 129 | $response = decode($response); |
130 | 130 | |
131 | 131 | return $response ?? new stdClass(); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | return Pluralizer::plural(strtolower($value)); |
139 | 139 | } |
140 | 140 | |
141 | - protected function response2Entity($resp, Entity $entity): ?Entity |
|
141 | + protected function response2Entity($resp, Entity $entity): ? Entity |
|
142 | 142 | { |
143 | 143 | if (isset($resp->result)) { |
144 | 144 | $this->mapper->map($resp->result, $entity); |