Total Complexity | 6 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | final class Hint extends AbstractWidget |
||
17 | { |
||
18 | private ?string $hint = ''; |
||
19 | private string $tag = 'div'; |
||
20 | |||
21 | /** |
||
22 | * Set hint text. |
||
23 | * |
||
24 | * @param string|null $value |
||
25 | * |
||
26 | * @return static |
||
27 | */ |
||
28 | 8 | public function hint(?string $value): self |
|
29 | { |
||
30 | 8 | $new = clone $this; |
|
31 | 8 | $new->hint = $value; |
|
32 | 8 | return $new; |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * Set the container tag name for the hint. |
||
37 | * |
||
38 | * @param string $value Container tag name. Set to empty value to render error messages without container tag. |
||
39 | * |
||
40 | * @return static |
||
41 | */ |
||
42 | 7 | public function tag(string $value): self |
|
43 | { |
||
44 | 7 | $new = clone $this; |
|
45 | 7 | $new->tag = $value; |
|
46 | 7 | return $new; |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * Generates a hint tag for the given form attribute. |
||
51 | * |
||
52 | * @return string the generated hint tag. |
||
53 | */ |
||
54 | 181 | protected function run(): string |
|
73 | } |
||
74 | } |
||
75 |