Total Complexity | 8 |
Total Lines | 85 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | final class Hint extends Widget |
||
14 | { |
||
15 | use FormAttributeTrait; |
||
16 | |||
17 | /** |
||
18 | * @psalm-var non-empty-string |
||
19 | */ |
||
20 | private string $tag = 'div'; |
||
21 | private array $attributes = []; |
||
22 | |||
23 | /** |
||
24 | * @var string|Stringable|null |
||
25 | */ |
||
26 | private $content = null; |
||
27 | |||
28 | private bool $encode = true; |
||
29 | |||
30 | /** |
||
31 | * Set the container tag name for the hint. |
||
32 | * |
||
33 | * @param string $tag Container tag name. Set to empty value to render error messages without container tag. |
||
34 | * |
||
35 | * @return static |
||
36 | */ |
||
37 | public function tag(string $tag): self |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @return static |
||
50 | */ |
||
51 | public function tagAttributes(array $attributes): self |
||
52 | { |
||
53 | $new = clone $this; |
||
54 | $new->attributes = $attributes; |
||
55 | return $new; |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @param string|Stringable|null $content |
||
60 | * |
||
61 | * @return static |
||
62 | */ |
||
63 | public function content($content): self |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * Whether content should be HTML-encoded. |
||
72 | * |
||
73 | * @param bool $value |
||
74 | * |
||
75 | * @return static |
||
76 | */ |
||
77 | public function encode(bool $value): self |
||
78 | { |
||
79 | $new = clone $this; |
||
80 | $new->encode = $value; |
||
81 | return $new; |
||
82 | } |
||
83 | |||
84 | protected function run(): string |
||
98 | } |
||
99 | } |
||
100 |