@@ -23,10 +23,10 @@ |
||
| 23 | 23 | $keys = array_map('strtolower', $keys); |
| 24 | 24 | |
| 25 | 25 | foreach ($input as $key => $value) { |
| 26 | - if(is_array($value)) { |
|
| 26 | + if (is_array($value)) { |
|
| 27 | 27 | $input[$key] = static::replaceValuesByMatchingKeys($value, $keys, $replacement); |
| 28 | 28 | } |
| 29 | - elseif(is_string($key) && in_array(strtolower($key), $keys)) { |
|
| 29 | + elseif (is_string($key) && in_array(strtolower($key), $keys)) { |
|
| 30 | 30 | $input[$key] = $replacement instanceof \Closure |
| 31 | 31 | ? $replacement($key, $value) |
| 32 | 32 | : $replacement; |
@@ -25,8 +25,7 @@ |
||
| 25 | 25 | foreach ($input as $key => $value) { |
| 26 | 26 | if(is_array($value)) { |
| 27 | 27 | $input[$key] = static::replaceValuesByMatchingKeys($value, $keys, $replacement); |
| 28 | - } |
|
| 29 | - elseif(is_string($key) && in_array(strtolower($key), $keys)) { |
|
| 28 | + } elseif(is_string($key) && in_array(strtolower($key), $keys)) { |
|
| 30 | 29 | $input[$key] = $replacement instanceof \Closure |
| 31 | 30 | ? $replacement($key, $value) |
| 32 | 31 | : $replacement; |
@@ -380,7 +380,7 @@ |
||
| 380 | 380 | $this->log(null, $decoded ?? []); |
| 381 | 381 | |
| 382 | 382 | if($this->success()) { |
| 383 | - return $this->formatted; |
|
| 383 | + return $this->formatted; |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | $message = array_get($this->formatted, 'message'); |
@@ -64,15 +64,15 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | protected function boot() |
| 66 | 66 | { |
| 67 | - if(!$publicKey = $this->credential('public')) { |
|
| 67 | + if (!$publicKey = $this->credential('public')) { |
|
| 68 | 68 | throw new \InvalidArgumentException('Public key must be defined'); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if(!$secretKey = $this->credential('secret')) { |
|
| 71 | + if (!$secretKey = $this->credential('secret')) { |
|
| 72 | 72 | throw new \InvalidArgumentException('Secret key must be defined'); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if(!$this->client) { |
|
| 75 | + if (!$this->client) { |
|
| 76 | 76 | $handler = new \GuzzleHttp\HandlerStack(); |
| 77 | 77 | $handler->setHandler(new \GuzzleHttp\Handler\CurlHandler()); |
| 78 | 78 | $handler->push($this->bearerTokenHeader()); |
@@ -275,11 +275,11 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | public function request(string $name, array $parameters = []): array |
| 277 | 277 | { |
| 278 | - if(!$this->hasRequest($name)) { |
|
| 278 | + if (!$this->hasRequest($name)) { |
|
| 279 | 279 | throw new \InvalidArgumentException("Request `{$name}` is not supported"); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if(!method_exists($this, $name)) { |
|
| 282 | + if (!method_exists($this, $name)) { |
|
| 283 | 283 | throw new \InvalidArgumentException("Request `{$name}` listed but is not implemented"); |
| 284 | 284 | } |
| 285 | 285 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | */ |
| 312 | 312 | public function success(bool $withStatus = false): bool |
| 313 | 313 | { |
| 314 | - if(!$this->response || $this->response->getStatusCode() !== 200) { |
|
| 314 | + if (!$this->response || $this->response->getStatusCode() !== 200) { |
|
| 315 | 315 | return false; |
| 316 | 316 | } |
| 317 | 317 | |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | $this->log(null, $decoded ?? []); |
| 381 | 381 | |
| 382 | - if($this->success()) { |
|
| 382 | + if ($this->success()) { |
|
| 383 | 383 | return $this->formatted; |
| 384 | 384 | } |
| 385 | 385 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | private function bearerToken() |
| 409 | 409 | { |
| 410 | - if(!$token = app('auth')->token()) { |
|
| 410 | + if (!$token = app('auth')->token()) { |
|
| 411 | 411 | return null; |
| 412 | 412 | } |
| 413 | 413 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | public function bearerTokenHeader(): \Closure |
| 423 | 423 | { |
| 424 | 424 | return function(callable $handler) { |
| 425 | - return function (\Psr\Http\Message\RequestInterface $request, array $options) use ($handler) { |
|
| 425 | + return function(\Psr\Http\Message\RequestInterface $request, array $options) use ($handler) { |
|
| 426 | 426 | $request = $request->withHeader('Authorization', $this->bearerToken()); |
| 427 | 427 | |
| 428 | 428 | return $handler($request, $options); |