| Conditions | 5 |
| Paths | 8 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | public static function make(string $key) |
||
| 35 | { |
||
| 36 | if (!DI::$initialized) { |
||
| 37 | DI::init(); |
||
| 38 | DI::$initialized = true; |
||
| 39 | } |
||
| 40 | $container = DI::$containers[$key] ?? null; |
||
| 41 | if ($container == null) { |
||
| 42 | throw new BindingResolutionException('Failed to resolve [' . $key . ']'); |
||
| 43 | } |
||
| 44 | if (is_callable($container)) { |
||
| 45 | $container = $container(); |
||
| 46 | if (DI::$singletons[$key]) { |
||
| 47 | DI::$containers[$key] = $container; |
||
| 48 | } |
||
| 49 | } |
||
| 50 | return $container; |
||
| 51 | } |
||
| 52 | } |