Passed
Branch master (61095c)
by Tomáš
01:50
created

LiveCarrierProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 15
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getCarriers() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Inspirum\Balikobot\Provider;
6
7
use Inspirum\Balikobot\Model\Carrier\Carrier;
8
use Inspirum\Balikobot\Service\SettingService;
9
use function array_map;
10
11
final class LiveCarrierProvider implements CarrierProvider
12
{
13 3
    public function __construct(
14
        private readonly SettingService $settingService,
15
    ) {
16 3
    }
17
18
    /**
19
     * @return array<string>
20
     *
21
     * @throws \Inspirum\Balikobot\Exception\Exception
22
     */
23 3
    public function getCarriers(): array
24
    {
25 3
        return array_map(static fn(Carrier $carrier): string => $carrier->getCode(), $this->settingService->getCarriers()->getCarriers());
26
    }
27
}
28