Code Duplication    Length = 33-33 lines in 2 locations

src/Traits/SmartLoad.php 2 locations

@@ 287-319 (lines=33) @@
284
     * @param bool   $pinless
285
     * @param bool   $sendSms
286
     */
287
    public function prevend($dealerMsisdn, $clientReference, $smsRecipientMsisdn, $deviceId, $productId, $amount, $pinless, $sendSms)
288
    {
289
        try {
290
            $response = $this->post(
291
                '/webservice/smartload/prevend',
292
                [
293
                    'headers' => [
294
                        'Authorization' => $this->bearerOrBasic(),
295
                    ],
296
                    'json' => [
297
                        'smartloadId'        => $dealerMsisdn,
298
                        'clientReference'    => $clientReference,
299
                        'smsRecipientMsisdn' => $smsRecipientMsisdn,
300
                        'deviceId'           => $deviceId,
301
                        'productId'          => $productId,
302
                        'amount'             => $amount,
303
                        'pinless'            => $pinless,
304
                        'sendSms'            => $sendSms,
305
                    ],
306
                ]
307
            );
308
309
            return [
310
                'status'    => 'ok',
311
                'http_code' => $response->getStatusCode(),
312
                'body'      => (string) $response->getBody(),
313
            ];
314
        } catch (\GuzzleHttp\Exception\ClientException $e) {
315
            return $this->clientError($e);
316
        } catch (\GuzzleHttp\Exception\ServerException $e) {
317
            return $this->parseError($e);
318
        }
319
    }
320
321
    /**
322
     * Authenticate and retrieves a list of all available networks.
@@ 369-401 (lines=33) @@
366
     * @param bool   $pinless
367
     * @param bool   $sendSms
368
     */
369
    public function recharge($dealerMsisdn, $clientReference, $smsRecipientMsisdn, $deviceId, $productId, $amount, $pinless, $sendSms)
370
    {
371
        try {
372
            $response = $this->post(
373
                '/webservice/smartload/recharges',
374
                [
375
                    'headers' => [
376
                        'Authorization' => $this->bearerOrBasic(),
377
                    ],
378
                    'json' => [
379
                        'smartloadId'        => $dealerMsisdn,
380
                        'clientReference'    => $clientReference,
381
                        'smsRecipientMsisdn' => $smsRecipientMsisdn,
382
                        'deviceId'           => $deviceId,
383
                        'productId'          => $productId,
384
                        'amount'             => $amount,
385
                        'pinless'            => $pinless,
386
                        'sendSms'            => $sendSms,
387
                    ],
388
                ]
389
            );
390
391
            return [
392
                'status'    => 'ok',
393
                'http_code' => $response->getStatusCode(),
394
                'body'      => (string) $response->getBody(),
395
            ];
396
        } catch (\GuzzleHttp\Exception\ClientException $e) {
397
            return $this->clientError($e);
398
        } catch (\GuzzleHttp\Exception\ServerException $e) {
399
            return $this->parseError($e);
400
        }
401
    }
402
403
    /**
404
     * Authenticate and checks if the provided ID (MSISDN) is registered with Smartload.