| Conditions | 9 |
| Paths | 22 |
| Total Lines | 29 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 17 |
| CRAP Score | 9 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 74 | 141 | protected function run(): string |
|
| 75 | { |
||
| 76 | 141 | $useModel = $this->hasFormModelAndAttribute(); |
|
| 77 | |||
| 78 | 141 | $content = $useModel |
|
| 79 | 109 | ? $this->content ?? $this->getAttributeLabel() |
|
| 80 | 34 | : (string) $this->content; |
|
| 81 | |||
| 82 | 141 | if ($content === '') { |
|
| 83 | 34 | return ''; |
|
| 84 | } |
||
| 85 | |||
| 86 | 109 | $tag = Html::label($content); |
|
| 87 | |||
| 88 | 109 | if ($this->setForAttribute) { |
|
| 89 | 105 | $id = $this->forId; |
|
| 90 | 105 | if ($useModel && $id === null && $this->useInputIdAttribute) { |
|
| 91 | 80 | $id = $this->getInputId(); |
|
| 92 | } |
||
| 93 | 105 | if ($id !== null) { |
|
| 94 | 85 | $tag = $tag->forId($id); |
|
| 95 | } |
||
| 96 | } |
||
| 97 | |||
| 98 | 109 | if (!$this->encode) { |
|
| 99 | 1 | $tag = $tag->encode(false); |
|
| 100 | } |
||
| 101 | |||
| 102 | 109 | return $tag->render(); |
|
| 103 | } |
||
| 105 |