Total Complexity | 14 |
Total Lines | 91 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class Label extends Widget |
||
13 | { |
||
14 | use FormAttributeTrait; |
||
15 | |||
16 | private bool $setForAttribute = true; |
||
17 | |||
18 | private ?string $forId = null; |
||
19 | private bool $useInputIdAttribute = true; |
||
20 | |||
21 | private string|Stringable|null $content = null; |
||
22 | |||
23 | private bool $encode = true; |
||
24 | |||
25 | 4 | public function setForAttribute(bool $value): self |
|
26 | { |
||
27 | 4 | $new = clone $this; |
|
28 | 4 | $new->setForAttribute = $value; |
|
29 | 4 | return $new; |
|
30 | } |
||
31 | |||
32 | /** |
||
33 | * @return static |
||
34 | */ |
||
35 | 4 | public function forId(?string $id): self |
|
36 | { |
||
37 | 4 | $new = clone $this; |
|
38 | 4 | $new->forId = $id; |
|
39 | 4 | return $new; |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return static |
||
44 | */ |
||
45 | 9 | public function useInputIdAttribute(bool $value): self |
|
46 | { |
||
47 | 9 | $new = clone $this; |
|
48 | 9 | $new->useInputIdAttribute = $value; |
|
49 | 9 | return $new; |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * @return static |
||
54 | */ |
||
55 | 8 | public function content(string|Stringable|null $content): self |
|
60 | } |
||
61 | |||
62 | /** |
||
63 | * Whether content should be HTML-encoded. |
||
64 | * |
||
65 | * @return static |
||
66 | */ |
||
67 | 1 | public function encode(bool $value): self |
|
72 | } |
||
73 | |||
74 | 98 | protected function run(): string |
|
105 |