Code Duplication    Length = 16-16 lines in 4 locations

src/Services/Client.php 4 locations

@@ 321-336 (lines=16) @@
318
     *
319
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
320
     */
321
    public function getManipulationUnits(string $shipper): array
322
    {
323
        $response = $this->requester->call('v1', $shipper, Request::MANIPULATION_UNITS);
324
325
        if ($response['units'] === null) {
326
            return [];
327
        }
328
329
        $units = [];
330
331
        foreach ($response['units'] as $item) {
332
            $units[$item['code']] = $item['name'];
333
        }
334
335
        return $units;
336
    }
337
338
    /**
339
     * Returns available branches for the given shipper and its service
@@ 418-433 (lines=16) @@
415
     *
416
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
417
     */
418
    public function getCodCountries(string $shipper): array
419
    {
420
        $response = $this->requester->call('v1', $shipper, Request::CASH_ON_DELIVERY_COUNTRIES);
421
422
        if ($response['service_types'] === null) {
423
            return [];
424
        }
425
426
        $services = [];
427
428
        foreach ($response['service_types'] as $item) {
429
            $services[$item['service_type']] = $item['cod_countries'];
430
        }
431
432
        return $services;
433
    }
434
435
    /**
436
     * Returns list of countries where service is available in
@@ 444-459 (lines=16) @@
441
     *
442
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
443
     */
444
    public function getCountries(string $shipper): array
445
    {
446
        $response = $this->requester->call('v1', $shipper, Request::COUNTRIES);
447
448
        if ($response['service_types'] === null) {
449
            return [];
450
        }
451
452
        $services = [];
453
454
        foreach ($response['service_types'] as $item) {
455
            $services[$item['service_type']] = $item['countries'];
456
        }
457
458
        return $services;
459
    }
460
461
    /**
462
     * Returns available branches for the given shipper and its service
@@ 528-543 (lines=16) @@
525
     *
526
     * @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
527
     */
528
    public function getAdrUnits(string $shipper): array
529
    {
530
        $response = $this->requester->call('v1', $shipper, Request::ADR_UNITS);
531
532
        if ($response['units'] === null) {
533
            return [];
534
        }
535
536
        $units = [];
537
538
        foreach ($response['units'] as $item) {
539
            $units[$item['code']] = $item['name'];
540
        }
541
542
        return $units;
543
    }
544
545
    /**
546
     * Returns available activated services for the given shipper