@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * |
| 123 | 123 | * @return string|null |
| 124 | 124 | */ |
| 125 | - public function getLastUrl(): string|null |
|
| 125 | + public function getLastUrl(): string | null |
|
| 126 | 126 | { |
| 127 | 127 | return $this->last_url; |
| 128 | 128 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * |
| 133 | 133 | * @return \Psr\Http\Message\ResponseInterface|null |
| 134 | 134 | */ |
| 135 | - public function getLastResponse(): ResponseInterface|null |
|
| 135 | + public function getLastResponse(): ResponseInterface | null |
|
| 136 | 136 | { |
| 137 | 137 | return $this->last_response; |
| 138 | 138 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | ); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - return (string)$this->last_response->getBody(); |
|
| 157 | + return (string) $this->last_response->getBody(); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | if (json_last_error() !== JSON_ERROR_NONE) { |
| 178 | 178 | throw new ApiException( |
| 179 | - message: 'Error al decodificar JSON: ' . json_last_error_msg() |
|
| 179 | + message: 'Error al decodificar JSON: '.json_last_error_msg() |
|
| 180 | 180 | ); |
| 181 | 181 | } |
| 182 | 182 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | } elseif (!empty($body['exception'])) { |
| 229 | 229 | $body = $this->getError()->message; |
| 230 | 230 | } else { |
| 231 | - $body = 'Error no determinado: ' . json_encode($body); |
|
| 231 | + $body = 'Error no determinado: '.json_encode($body); |
|
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | string $resource, |
| 256 | 256 | array $headers = [], |
| 257 | 257 | array $options = [] |
| 258 | - ): ResponseInterface|null { |
|
| 258 | + ): ResponseInterface | null { |
|
| 259 | 259 | return $this->consume( |
| 260 | 260 | resource: $resource, |
| 261 | 261 | data: [], |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | array $data, |
| 280 | 280 | array $headers = [], |
| 281 | 281 | array $options = [] |
| 282 | - ): ResponseInterface|null { |
|
| 282 | + ): ResponseInterface | null { |
|
| 283 | 283 | return $this->consume( |
| 284 | 284 | resource: $resource, |
| 285 | 285 | data: $data, |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | array $data, |
| 304 | 304 | array $headers = [], |
| 305 | 305 | array $options = [] |
| 306 | - ): ResponseInterface|null { |
|
| 306 | + ): ResponseInterface | null { |
|
| 307 | 307 | return $this->consume( |
| 308 | 308 | resource: $resource, |
| 309 | 309 | data: $data, |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | string $resource, |
| 326 | 326 | array $headers = [], |
| 327 | 327 | array $options = [] |
| 328 | - ): ResponseInterface|null { |
|
| 328 | + ): ResponseInterface | null { |
|
| 329 | 329 | return $this->consume( |
| 330 | 330 | resource: $resource, |
| 331 | 331 | data: [], |
@@ -365,15 +365,15 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | $method = $method ?: ($data ? 'POST' : 'GET'); |
| 367 | 367 | $client = new \GuzzleHttp\Client(); |
| 368 | - $this->last_url = $this->api_url . |
|
| 369 | - $this->api_prefix . |
|
| 368 | + $this->last_url = $this->api_url. |
|
| 369 | + $this->api_prefix. |
|
| 370 | 370 | '/'. |
| 371 | - $this->api_version . |
|
| 371 | + $this->api_version. |
|
| 372 | 372 | $resource; |
| 373 | 373 | |
| 374 | 374 | // preparar cabeceras que se usarán |
| 375 | 375 | $options[\GuzzleHttp\RequestOptions::HEADERS] = array_merge([ |
| 376 | - 'Authorization' => 'Bearer ' . $this->api_token, |
|
| 376 | + 'Authorization' => 'Bearer '.$this->api_token, |
|
| 377 | 377 | 'Content-Type' => 'application/json', |
| 378 | 378 | 'Accept' => 'application/json', |
| 379 | 379 | ], $headers); |
@@ -427,10 +427,10 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | // Se maneja el caso donde no se encuentra un mensaje de error específico |
| 429 | 429 | if (!$message || $message === '') { |
| 430 | - $message = '[API Gateway] Código HTTP ' . $code . ': ' . $reasonPhrase; |
|
| 430 | + $message = '[API Gateway] Código HTTP '.$code.': '.$reasonPhrase; |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - return (object)[ |
|
| 433 | + return (object) [ |
|
| 434 | 434 | 'code' => $code, |
| 435 | 435 | 'message' => $message, |
| 436 | 436 | ]; |