Total Complexity | 5 |
Total Lines | 20 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | abstract class AbstractServiceFactory implements ServiceFactoryInterface |
||
11 | { |
||
12 | public function pledge(ContainerInterface $container, array $args = []): Closure |
||
13 | { |
||
14 | return fn () => $this->create($container, $args); |
||
15 | } |
||
16 | |||
17 | public function commit(ContainerInterface $container, array $args = []): Closure |
||
18 | { |
||
19 | return ServiceEnclosure::enclose($this->pledge($container, $args)); |
||
20 | } |
||
21 | |||
22 | protected function getNullable(string $service, ContainerInterface $container) |
||
23 | { |
||
24 | return $container->has($service) ? $container->get($service) : null; |
||
25 | } |
||
26 | |||
27 | public static function instance(): ServiceFactoryInterface |
||
30 | } |
||
31 | } |
||
32 |