Completed
Push — master ( 78ef8c...6e8e35 )
by Luke
03:10
created
src/Methods/AbstractMethod.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
         } catch (ClientException $e) {
92 92
             $responseContents = json_decode($e->getResponse()->getBody(true)->getContents(), true);
93 93
 
94
-            if (false !== $responseContents && !empty($responseContents['error_advice'])) {
95
-                throw new \Exception($responseContents['error_advice']);
94
+            if (false !== $responseContents && !empty($responseContents[ 'error_advice' ])) {
95
+                throw new \Exception($responseContents[ 'error_advice' ]);
96 96
             }
97 97
 
98 98
             throw new \Exception($e->getMessage());
Please login to merge, or discard this patch.