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