Code Duplication    Length = 31-32 lines in 2 locations

src/Client.php 2 locations

@@ 230-260 (lines=31) @@
227
     *
228
     * @return array
229
     */
230
    public function cashup($dealerMsisdn, $start, $end)
231
    {
232
        try {
233
            $response = $this->post(
234
                '/webservice/smartload/cashup',
235
                [
236
                    'headers' => [
237
                        'Authorization' => sprintf(
238
                            'Bearer %s',
239
                            $this->options['token']
240
                        ),
241
                    ],
242
                    'json'    => [
243
                        'smartloadId' => $dealerMsisdn,
244
                        'startDate'   => $start,
245
                        'endDate'     => $end,
246
                    ],
247
                ]
248
            );
249
250
            return [
251
                'status'    => 'ok',
252
                'http_code' => $response->getStatusCode(),
253
                'body'      => (string) $response->getBody(),
254
            ];
255
        } catch (\GuzzleHttp\Exception\ClientException $e) {
256
            return $this->clientError($e);
257
        } catch (\GuzzleHttp\Exception\ServerException $e) {
258
            return $this->parseError($e);
259
        }
260
    }
261
262
    /**
263
     * Authenticate and retrieves the dealer balance in Rands.
@@ 351-382 (lines=32) @@
348
     *
349
     * @return array
350
     */
351
    public function fundstransfer($fromDealerMsisdn, $toDealerMsisdn, $amount, $sendSms)
352
    {
353
        try {
354
            $response = $this->post(
355
                '/webservice/smartload/fundstransfer',
356
                [
357
                    'headers' => [
358
                        'Authorization' => sprintf(
359
                            'Bearer %s',
360
                            $this->options['token']
361
                        ),
362
                    ],
363
                    'json' => [
364
                        'sourceSmartloadId'    => $fromDealerMsisdn,
365
                        'recipientSmartloadId' => $toDealerMsisdn,
366
                        'amount'               => $amount,
367
                        'sendSms'              => $sendSms,
368
                    ],
369
                ]
370
            );
371
372
            return [
373
                'status'    => 'ok',
374
                'http_code' => $response->getStatusCode(),
375
                'body'      => (string) $response->getBody(),
376
            ];
377
        } catch (\GuzzleHttp\Exception\ClientException $e) {
378
            return $this->clientError($e);
379
        } catch (\GuzzleHttp\Exception\ServerException $e) {
380
            return $this->parseError($e);
381
        }
382
    }
383
384
    /**
385
     * Authenticate and retrieves a list of all available networks.