Test Setup Failed
Branch master (0f1f91)
by Steeven
02:30
created
Category
src/Citcall.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -150,30 +150,30 @@  discard block
 block discarded – undo
150 150
     protected function request($path, $params = [], $type = 'GET')
151 151
     {
152 152
         // default params
153
-        if (empty($this->config[ 'apiUrl' ])) {
153
+        if (empty($this->config['apiUrl'])) {
154 154
             throw new \InvalidArgumentException('Citcall: API Url is not set!');
155 155
         }
156 156
 
157
-        if (empty($this->config[ 'userId' ])) {
157
+        if (empty($this->config['userId'])) {
158 158
             throw new \InvalidArgumentException('Citcall: User ID is not set');
159 159
         }
160 160
 
161
-        if (empty($this->config[ 'apiKey' ])) {
161
+        if (empty($this->config['apiKey'])) {
162 162
             throw new \InvalidArgumentException('Citcall: API Key is not set');
163 163
         }
164 164
 
165
-        $uri = (new Uri($this->config[ 'apiUrl' ]))
166
-            ->withPath($this->config[ 'version' ])
165
+        $uri = (new Uri($this->config['apiUrl']))
166
+            ->withPath($this->config['version'])
167 167
             ->withPath($path);
168 168
 
169 169
         $request = new Curl\Request();
170 170
         $request->setHeaders([
171
-            'Authorization' => base64_encode($this->config[ 'userId' ] . ':' . $this->config[ 'apiKey' ]),
171
+            'Authorization' => base64_encode($this->config['userId'] . ':' . $this->config['apiKey']),
172 172
         ]);
173 173
         $request->setConnectionTimeout(500);
174 174
 
175
-        if ($this->config[ 'retry' ] > 0 and $this->config[ 'retry' ] <= 20) {
176
-            $params[ 'limit_try' ] = $this->config[ 'retry' ]; // default 5
175
+        if ($this->config['retry'] > 0 and $this->config['retry'] <= 20) {
176
+            $params['limit_try'] = $this->config['retry']; // default 5
177 177
         }
178 178
 
179 179
         if ($this->response = $request->setUri($uri)->post($params, true)) {
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
             throw new \InvalidArgumentException('Citcall: Invalid MSISDN Number');
230 230
         }
231 231
 
232
-        $senderId = empty($this->config[ 'senderId' ]) ? $this->config[ 'userId' ] : $this->config[ 'senderId' ];
232
+        $senderId = empty($this->config['senderId']) ? $this->config['userId'] : $this->config['senderId'];
233 233
 
234 234
         return $this->request('sms', [
235 235
             'senderid' => $senderId,
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
             throw new \InvalidArgumentException('Citcall: Invalid MSISDN Number');
259 259
         }
260 260
 
261
-        if ( ! is_int($gateway) or $gateway > 5 or $gateway < 0) {
261
+        if (!is_int($gateway) or $gateway > 5 or $gateway < 0) {
262 262
             throw new \InvalidArgumentException('Citcall: Invalid Gateway Number');
263 263
         }
264 264
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
         return $this->request($path, [
268 268
             'msisdn'  => $msisdn,
269
-            'gateway' => (int)$gateway,
269
+            'gateway' => (int) $gateway,
270 270
         ]);
271 271
     }
272 272
     // ------------------------------------------------------------------------
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
             throw new \InvalidArgumentException('Citcall: Invalid MSISDN Number');
290 290
         }
291 291
 
292
-        $params[ 'msisdn' ] = $msisdn;
292
+        $params['msisdn'] = $msisdn;
293 293
 
294 294
         if (isset($token)) {
295 295
             if (strlen($token) < 4) {
@@ -298,11 +298,11 @@  discard block
 block discarded – undo
298 298
                 throw new \InvalidArgumentException('Citcall: OTP Code maximum length is 8 digit');
299 299
             }
300 300
 
301
-            $params[ 'token' ] = trim($token);
301
+            $params['token'] = trim($token);
302 302
         }
303 303
 
304 304
         if ($expires > 0) {
305
-            $params[ 'valid_time' ] = $expires;
305
+            $params['valid_time'] = $expires;
306 306
         }
307 307
 
308 308
         return $this->request('smsotp', $params);
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
             'msg' => 'invalid callback response'
361 361
         ]);
362 362
 
363
-        if($response = file_get_contents('php://input')) {
363
+        if ($response = file_get_contents('php://input')) {
364 364
             $data = json_decode($response, true);
365 365
 
366
-            if(json_last_error() !== JSON_ERROR_NONE) {
366
+            if (json_last_error() !== JSON_ERROR_NONE) {
367 367
                 $result = new Curl\Response\SimpleJSONElement($data);
368 368
             }
369 369
         }
Please login to merge, or discard this patch.