Total Complexity | 7 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class SdkClientRegistry |
||
10 | { |
||
11 | /** var array<string, SdkClient> $sdkClientList */ |
||
12 | private $sdkClientList; |
||
13 | |||
14 | /** |
||
15 | * @param array<string, SdkClient> $sdkClientList |
||
16 | */ |
||
17 | public function __construct(array $sdkClientList) |
||
20 | 1 | } |
|
21 | |||
22 | public function getSdkClient(string $name): SdkClient |
||
23 | { |
||
24 | 1 | $client = $this->sdkClientList[$name] ?? null; |
|
25 | |||
26 | 1 | if (!$client) { |
|
27 | 1 | throw new SdkClientNotFoundException( |
|
28 | 1 | 'Sdk client not found for name ' . $name |
|
29 | ); |
||
30 | } |
||
31 | |||
32 | 1 | return $client; |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return array<SdkClient> |
||
37 | */ |
||
38 | public function getSdkClientList(): array |
||
39 | { |
||
40 | 1 | return $this->sdkClientList; |
|
41 | } |
||
42 | |||
43 | public function getSdkClientForClass(string $entityClassname): SdkClient |
||
53 | ); |
||
54 | } |
||
55 | } |
||
56 |