Total Complexity | 6 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Coverage | 81.82% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | final class DependencyResolver implements DependencyResolverInterface |
||
17 | { |
||
18 | private ContainerInterface $container; |
||
19 | 98 | private ?Injector $injector = null; |
|
20 | |||
21 | 98 | public function __construct(ContainerInterface $container) |
|
22 | 98 | { |
|
23 | $this->container = $container; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @param string $id |
||
28 | * |
||
29 | * @throws NotFoundExceptionInterface |
||
30 | * @throws ContainerExceptionInterface |
||
31 | * |
||
32 | * @return mixed|object |
||
33 | * |
||
34 | 61 | * @psalm-suppress InvalidThrow |
|
35 | */ |
||
36 | 61 | public function get($id) |
|
37 | { |
||
38 | return $this->container->get($id); |
||
39 | } |
||
40 | |||
41 | public function has($id): bool |
||
42 | { |
||
43 | return $this->container->has($id); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @param string $id |
||
48 | * |
||
49 | * @throws NotFoundExceptionInterface |
||
50 | * @throws ContainerExceptionInterface |
||
51 | * |
||
52 | * @return mixed|object |
||
53 | * |
||
54 | 47 | * @psalm-suppress InvalidThrow |
|
55 | */ |
||
56 | 47 | public function resolve(string $id) |
|
59 | 91 | } |
|
60 | |||
61 | 91 | public function invoke(callable $callable) |
|
62 | { |
||
63 | return $this->getInjector()->invoke($callable); |
||
64 | } |
||
65 | |||
66 | private function getInjector(): Injector |
||
69 | } |
||
70 | } |
||
71 |