Completed
Push — master ( 41d8b0...fbc26c )
by Vladimir
13:06
created
src/Api.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace AcquiroPay;
6 6
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function callService(string $service, string $method, string $endpoint, array $parameters = null)
70 70
     {
71
-        return $this->call($method, '/services/' . $service, ['Endpoint' => $endpoint], $parameters);
71
+        return $this->call($method, '/services/'.$service, ['Endpoint' => $endpoint], $parameters);
72 72
     }
73 73
 
74 74
     /**
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
     public function call(string $method, string $endpoint, array $headers = [], array $parameters = null)
87 87
     {
88 88
         $stream = $this->makeCallRequest($method, $endpoint, $headers, $parameters);
89
-        $json = json_decode((string)$stream);
89
+        $json = json_decode((string) $stream);
90 90
 
91 91
         if (json_last_error() === JSON_ERROR_NONE) {
92 92
             return $json;
93 93
         }
94 94
 
95
-        return (string)$stream;
95
+        return (string) $stream;
96 96
     }
97 97
 
98 98
     /**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     {
118 118
         $method = Str::upper($method);
119 119
         if (!Str::startsWith($endpoint, ['http://', 'https://'])) {
120
-            $endpoint = $this->url . '/' . ltrim($endpoint, '/');
120
+            $endpoint = $this->url.'/'.ltrim($endpoint, '/');
121 121
         }
122 122
 
123 123
         try {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                 'headers' => array_merge([
126 126
                     'Accept' => 'application/json',
127 127
                     'Content-Type' => 'application/json',
128
-                    'Authorization' => 'Bearer ' . $this->token(),
128
+                    'Authorization' => 'Bearer '.$this->token(),
129 129
                 ], $headers),
130 130
             ];
131 131
 
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
         try {
181 181
             $headers = ['Content-Type' => 'application/json'];
182 182
 
183
-            $url = $this->url . '/authorize';
183
+            $url = $this->url.'/authorize';
184 184
 
185 185
             $body = json_encode(compact('token', 'service', 'method', 'endpoint'));
186 186
 
187 187
             $response = $this->http->send(new Request('POST', $url, $headers, $body));
188 188
 
189
-            $json = \GuzzleHttp\json_decode((string)$response->getBody());
189
+            $json = \GuzzleHttp\json_decode((string) $response->getBody());
190 190
 
191 191
             if (!isset($json->authorized, $json->consumer_id) || $json->authorized !== true) {
192 192
                 throw new UnauthorizedException;
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
 
205 205
     protected function token(): ?string
206 206
     {
207
-        return $this->cache->remember('acquiropay_api_token_' . md5($this->url), 10, function () {
207
+        return $this->cache->remember('acquiropay_api_token_'.md5($this->url), 10, function() {
208 208
             $response = $this->http->post(
209
-                $this->url . '/login',
209
+                $this->url.'/login',
210 210
                 ['form_params' => ['username' => $this->username, 'password' => $this->password]]
211 211
             );
212 212
 
213
-            return (string)$response->getBody();
213
+            return (string) $response->getBody();
214 214
         });
215 215
     }
216 216
 }
Please login to merge, or discard this patch.