Total Complexity | 11 |
Total Lines | 90 |
Duplicated Lines | 0 % |
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 | /** |
||
22 | * @var string|Stringable|null |
||
23 | */ |
||
24 | private $content = null; |
||
25 | |||
26 | private bool $encode = true; |
||
27 | |||
28 | public function setForAttribute(bool $value): self |
||
29 | { |
||
30 | $new = clone $this; |
||
31 | $new->setForAttribute = $value; |
||
32 | return $new; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return static |
||
37 | */ |
||
38 | public function forId(?string $id): self |
||
39 | { |
||
40 | $new = clone $this; |
||
41 | $new->forId = $id; |
||
42 | return $new; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @return static |
||
47 | */ |
||
48 | public function useInputIdAttribute(bool $value): self |
||
49 | { |
||
50 | $new = clone $this; |
||
51 | $new->useInputIdAttribute = $value; |
||
52 | return $new; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @param string|Stringable|null $content |
||
57 | * |
||
58 | * @return static |
||
59 | */ |
||
60 | public function content($content): self |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Whether content should be HTML-encoded. |
||
69 | * |
||
70 | * @param bool $value |
||
71 | * |
||
72 | * @return static |
||
73 | */ |
||
74 | public function encode(bool $value): self |
||
75 | { |
||
76 | $new = clone $this; |
||
77 | $new->encode = $value; |
||
78 | return $new; |
||
79 | } |
||
80 | |||
81 | protected function run(): string |
||
102 | } |
||
103 | } |
||
104 |