1 | <?php |
||
9 | final class MappingServices { |
||
10 | |||
11 | /** |
||
12 | * @var MappingService[] |
||
13 | */ |
||
14 | private $nameToServiceMap = []; |
||
15 | |||
16 | /** |
||
17 | * @var string Name of the default service, which is used as fallback |
||
18 | */ |
||
19 | private $defaultService; |
||
20 | |||
21 | /** |
||
22 | * @param string[] $availableServices |
||
23 | * @param string $defaultService |
||
24 | * @param MappingService ...$services |
||
25 | * @throws \InvalidArgumentException |
||
26 | */ |
||
27 | 20 | public function __construct( array $availableServices, string $defaultService, MappingService ...$services ) { |
|
44 | |||
45 | /** |
||
46 | * @param string $name Name or alias of a service |
||
47 | * @return bool |
||
48 | */ |
||
49 | 20 | public function nameIsKnown( string $name ): bool { |
|
52 | |||
53 | /** |
||
54 | * @param string $name Name or alias of a service |
||
55 | * @return MappingService |
||
56 | * @throws \OutOfBoundsException |
||
57 | */ |
||
58 | public function getService( string $name ): MappingService { |
||
65 | |||
66 | /** |
||
67 | * @param string $name Name or alias of a service |
||
68 | * @return MappingService |
||
69 | */ |
||
70 | 20 | public function getServiceOrDefault( string $name ): MappingService { |
|
77 | |||
78 | /** |
||
79 | * @deprecated |
||
80 | */ |
||
81 | 20 | public static function getServiceInstance( string $serviceIdentifier ): MappingService { |
|
84 | |||
85 | } |
||
86 |