Total Complexity | 6 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
13 | final class EnvLine implements LineInterface |
||
14 | { |
||
15 | 53 | public function __construct(private Key $key, private ?Value $value = null, private ?Comment $comment = null) |
|
17 | 53 | } |
|
18 | |||
19 | |||
20 | 9 | public function __toString(): string |
|
21 | { |
||
22 | 9 | $format = ($this->value === null) ? '%s%s%s' : '%s=%s%s'; |
|
23 | 9 | return sprintf( |
|
24 | 9 | $format, |
|
25 | 9 | $this->key->__toString(), |
|
26 | 9 | $this->value?->__toString() ?? '', |
|
27 | 9 | $this->comment?->__toString() ?? '' |
|
28 | 9 | ); |
|
29 | } |
||
30 | |||
31 | 45 | public function getKey(): Key |
|
32 | { |
||
33 | 45 | return $this->key; |
|
34 | } |
||
35 | |||
36 | 43 | public function getValue(): ?Value |
|
39 | } |
||
40 | |||
41 | 1 | public function getComment(): ?Comment |
|
44 | } |
||
45 | } |
||
46 |