Total Complexity | 3 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class ServiceLocator |
||
16 | { |
||
17 | /** |
||
18 | * method to register a service |
||
19 | * |
||
20 | * @param string $serviceKey the key for the service |
||
21 | * @param mixed $object |
||
22 | * @return void |
||
23 | */ |
||
24 | 34 | public static function registerService(string $serviceKey, $object): void |
|
25 | { |
||
26 | 34 | Container::getInstance()->set($serviceKey, $object); |
|
27 | } |
||
28 | |||
29 | /** |
||
30 | * checks if a service is registered |
||
31 | * |
||
32 | * @param string $serviceKey |
||
33 | * @return bool |
||
34 | */ |
||
35 | 12 | public static function hasService(string $serviceKey) |
|
38 | } |
||
39 | |||
40 | /** |
||
41 | * returns a service |
||
42 | * |
||
43 | * @param string $serviceKey the service key |
||
44 | * @return mixed |
||
45 | */ |
||
46 | 37 | public static function getService(string $serviceKey) |
|
49 | } |
||
50 | } |
||
51 |