1 | <?php |
||
11 | final class MappingServices { |
||
12 | |||
13 | /** |
||
14 | * @var MappingService[] |
||
15 | */ |
||
16 | private $nameToServiceMap = []; |
||
17 | |||
18 | /** |
||
19 | * @var string Name of the default service, which is used as fallback |
||
20 | */ |
||
21 | private $defaultService; |
||
22 | |||
23 | /** |
||
24 | * @param string[] $availableServices |
||
25 | * @param string $defaultService |
||
26 | * @param MappingService ...$services |
||
27 | * @throws \InvalidArgumentException |
||
28 | */ |
||
29 | 27 | public function __construct( array $availableServices, string $defaultService, MappingService ...$services ) { |
|
46 | |||
47 | /** |
||
48 | * @param string $name Name or alias of a service |
||
49 | * @return bool |
||
50 | */ |
||
51 | 27 | public function nameIsKnown( string $name ): bool { |
|
54 | |||
55 | /** |
||
56 | * @param string $name Name or alias of a service |
||
57 | * @return MappingService |
||
58 | * @throws \OutOfBoundsException |
||
59 | */ |
||
60 | public function getService( string $name ): MappingService { |
||
67 | |||
68 | /** |
||
69 | * @param string $name Name or alias of a service |
||
70 | * @return MappingService |
||
71 | */ |
||
72 | 27 | public function getServiceOrDefault( string $name ): MappingService { |
|
79 | |||
80 | 27 | public function getAllNames(): array { |
|
83 | |||
84 | 18 | public function getDefaultService(): MappingService { |
|
87 | |||
88 | } |
||
89 |