@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @param string|null $rut RUT del emisor de las BHE. # NUEVA LINEA |
| 85 | 85 | * @param string|null $url URL base de la API. |
| 86 | 86 | */ |
| 87 | - public function __construct($token = null, $rut= null, $url = null) |
|
| 87 | + public function __construct($token = null, $rut = null, $url = null) |
|
| 88 | 88 | { |
| 89 | 89 | $this->api_token = $token ?: $this->env('BHEXPRESS_API_TOKEN'); |
| 90 | 90 | if (!$this->api_token) { |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | throw new ApiException('No hay una respuesta HTTP previa para obtener el cuerpo.'); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - return (string)$this->last_response->getBody(); |
|
| 172 | + return (string) $this->last_response->getBody(); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $decodedBody = json_decode($this->getBody(), true); |
| 188 | 188 | |
| 189 | 189 | if (json_last_error() !== JSON_ERROR_NONE) { |
| 190 | - throw new ApiException('Error al decodificar JSON: ' . json_last_error_msg()); |
|
| 190 | + throw new ApiException('Error al decodificar JSON: '.json_last_error_msg()); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | return $decodedBody; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | } elseif (!empty($body['exception'])) { |
| 238 | 238 | $body = $this->getError()->message; |
| 239 | 239 | } else { |
| 240 | - $body = 'Error no determinado: ' . json_encode($body); |
|
| 240 | + $body = 'Error no determinado: '.json_encode($body); |
|
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | // preparar cabeceras que se usarán |
| 337 | 337 | $options[\GuzzleHttp\RequestOptions::HEADERS] = array_merge([ |
| 338 | - 'Authorization' => 'Token ' . $this->api_token, |
|
| 338 | + 'Authorization' => 'Token '.$this->api_token, |
|
| 339 | 339 | 'Content-Type' => 'application/json', |
| 340 | 340 | 'Accept' => 'application/json', |
| 341 | 341 | 'X-Bhexpress-Emisor' => $this->rut_emisor, # NUEVA LINEA |
@@ -385,10 +385,10 @@ discard block |
||
| 385 | 385 | |
| 386 | 386 | // Se maneja el caso donde no se encuentra un mensaje de error específico |
| 387 | 387 | if (!$message || $message === '') { |
| 388 | - $message = '[BHExpress API] Código HTTP ' . $code . ': ' . $reasonPhrase; |
|
| 388 | + $message = '[BHExpress API] Código HTTP '.$code.': '.$reasonPhrase; |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - return (object)[ |
|
| 391 | + return (object) [ |
|
| 392 | 392 | 'code' => $code, |
| 393 | 393 | 'message' => $message, |
| 394 | 394 | ]; |