Total Complexity | 3 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
22 | final class ContainerScope |
||
23 | { |
||
24 | /** @var ContainerInterface */ |
||
25 | private static $container; |
||
26 | |||
27 | /** |
||
28 | * Returns currently active container scope if any. |
||
29 | * |
||
30 | * @return null|ContainerInterface |
||
31 | */ |
||
32 | public static function getContainer(): ?ContainerInterface |
||
33 | { |
||
34 | return self::$container; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Invokes given closure or function withing global IoC scope. |
||
39 | * |
||
40 | * @param ContainerInterface $container |
||
41 | * @param callable $scope |
||
42 | * @return mixed |
||
43 | * @throws Throwable |
||
44 | */ |
||
45 | public static function runScope(ContainerInterface $container, callable $scope) |
||
55 | } |
||
56 | } |
||
58 |