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