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 | 98 | protected function run(): string |
|
75 | { |
||
76 | 98 | $useModel = $this->hasFormModelAndAttribute(); |
|
77 | |||
78 | 98 | $content = $useModel |
|
79 | 81 | ? $this->content ?? $this->getAttributeLabel() |
|
80 | 19 | : (string) $this->content; |
|
81 | |||
82 | 98 | if ($content === '') { |
|
83 | 19 | return ''; |
|
84 | } |
||
85 | |||
86 | 81 | $tag = Html::label($content); |
|
87 | |||
88 | 81 | if ($this->setForAttribute) { |
|
89 | 77 | $id = $this->forId; |
|
90 | 77 | if ($useModel && $id === null && $this->useInputIdAttribute) { |
|
91 | 64 | $id = $this->getInputId(); |
|
92 | } |
||
93 | 77 | if ($id !== null) { |
|
94 | 68 | $tag = $tag->forId($id); |
|
95 | } |
||
96 | } |
||
97 | |||
98 | 81 | if (!$this->encode) { |
|
99 | 1 | $tag = $tag->encode(false); |
|
100 | } |
||
101 | |||
102 | 81 | return $tag->render(); |
|
103 | } |
||
105 |