Total Complexity | 6 |
Total Lines | 71 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
16 | final class Dependency |
||
17 | { |
||
18 | private $name; |
||
19 | private $services; |
||
20 | private $parameters; |
||
21 | |||
22 | 9 | public function __construct( |
|
23 | Name $name, |
||
24 | Container $services, |
||
25 | Parameter ...$parameters |
||
26 | ) { |
||
27 | 9 | $this->name = $name; |
|
28 | 9 | $this->services = $services; |
|
29 | 9 | $this->parameters = Stream::of(Parameter::class, ...$parameters); |
|
30 | 9 | } |
|
31 | |||
32 | 4 | public function name(): Name |
|
33 | { |
||
34 | 4 | return $this->name; |
|
35 | } |
||
36 | |||
37 | 4 | public function exposed(): string |
|
58 | } |
||
59 | |||
60 | 4 | public function __toString(): string |
|
61 | { |
||
62 | 4 | $container = $this->services->compile(); |
|
63 | 4 | $property = new PropertyName($this->name); |
|
64 | |||
65 | return <<<PHP |
||
66 | 4 | \$arguments = (new \\Innmind\\Immutable\\Map('string', 'mixed')){$this->parameters()}; |
|
67 | 4 | \$this->$property = $container |
|
68 | PHP; |
||
69 | } |
||
70 | |||
71 | 4 | private function parameters(): string |
|
87 | } |
||
88 | } |
||
89 |