Total Complexity | 3 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | final class InjectingProviderProvider implements ProviderInterface |
||
12 | { |
||
13 | private InjectionPointInterface $ip; |
||
14 | private InjectorInterface $injector; |
||
15 | |||
16 | public function __construct(InjectionPointInterface $ip, InjectorInterface $injector) |
||
17 | { |
||
18 | $this->ip = $ip; |
||
19 | $this->injector = $injector; |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * @return mixed |
||
24 | */ |
||
25 | public function get() |
||
26 | { |
||
27 | $set = $this->ip->getParameter()->getAttributes(Set::class)[0]; |
||
28 | $instance = $set->newInstance(); |
||
29 | assert($instance instanceof Set); |
||
30 | |||
31 | return new class ($this->injector, $instance) implements ProviderInterface |
||
32 | { |
||
33 | private InjectorInterface $injector; |
||
34 | private Set $set; |
||
35 | |||
36 | public function __construct(InjectorInterface $injector, Set $set) |
||
37 | { |
||
38 | $this->injector = $injector; |
||
39 | $this->set = $set; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return mixed |
||
44 | */ |
||
45 | public function get() |
||
48 | } |
||
49 | }; |
||
50 | } |
||
51 | } |
||
52 |