Total Complexity | 3 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | trait MagicServiceLocatorTrait |
||
20 | { |
||
21 | /** |
||
22 | * Self make, i.e. instantiate current class using DI |
||
23 | * @return mixed |
||
24 | */ |
||
25 | public static function make() |
||
26 | { |
||
27 | $di = Di::getInstance(); |
||
28 | return $di->get(static::class); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Instantiate some service or other object using our DI |
||
33 | * @param string $id |
||
34 | * @param array $parameters |
||
35 | * @return mixed |
||
36 | */ |
||
37 | protected function serviceLocator(string $id, ?array $parameters = null) |
||
44 | } |
||
45 | } |
||
47 |