@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct($certificate, $env = 'sandbox') |
30 | 30 | { |
31 | - if (!in_array($env,['sandbox', 'live'])) { |
|
31 | + if (!in_array($env, [ 'sandbox', 'live' ])) { |
|
32 | 32 | throw new \Exception(sprintf('Invalid environment. %s is not in [sandbox, live]', $env)); |
33 | 33 | } |
34 | 34 | |
35 | 35 | $this->client = new Client([ |
36 | - 'base_uri' => $this->baseUri[$env], |
|
36 | + 'base_uri' => $this->baseUri[ $env ], |
|
37 | 37 | 'cert' => $certificate |
38 | 38 | ]); |
39 | 39 | } |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | throw new \Exception('Fails validation'); |
80 | 80 | } |
81 | 81 | |
82 | - try{ |
|
82 | + try { |
|
83 | 83 | $response = $this->getClient()->request('POST', $uri, [ |
84 | 84 | 'body' => $payload, |
85 | 85 | 'headers' => [ |
86 | - 'Content-Type' => 'application/json; profile=' . $schemaUri, |
|
86 | + 'Content-Type' => 'application/json; profile='.$schemaUri, |
|
87 | 87 | ], |
88 | 88 | ]); |
89 | 89 | |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | $statusCode = $e->getResponse()->getStatusCode(); |
93 | 93 | $responseContents = json_decode($e->getResponse()->getBody(true)->getContents()); |
94 | 94 | |
95 | - if (false !== $responseContents && !empty($responseContents['error_advice'])) { |
|
96 | - throw new \Exception($responseContents['error_advice']); |
|
95 | + if (false !== $responseContents && !empty($responseContents[ 'error_advice' ])) { |
|
96 | + throw new \Exception($responseContents[ 'error_advice' ]); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | throw new \Exception($e->getMessage()); |