Conditions | 7 |
Paths | 10 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | public static function getService(string $serviceId) |
||
33 | { |
||
34 | $service = isset(self::$services[$serviceId]) ? self::$services[$serviceId] : null; |
||
35 | if($service === null) |
||
36 | { |
||
37 | $service = self::$container->get($serviceId, ContainerInterface::NULL_ON_INVALID_REFERENCE); |
||
38 | if($service === null && self::$locator !== null && self::$locator->has($serviceId)) |
||
39 | { |
||
40 | $service = self::$locator->get($serviceId); |
||
41 | } |
||
42 | // If a service is found, save it locally. |
||
43 | if($service !== null) |
||
44 | { |
||
45 | self::$services[$serviceId] = $service; |
||
46 | } |
||
47 | } |
||
48 | return $service; |
||
49 | } |
||
65 |