LabelElement::toHTML()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace dokuwiki\Form;
4
5
/**
6
 * Class Label
7
 * @package dokuwiki\Form
8
 */
9
class LabelElement extends ValueElement
10
{
11
    /**
12
     * Creates a new Label
13
     *
14
     * @param string $label This is is raw HTML and will not be escaped
15
     */
16
    public function __construct($label)
17
    {
18
        parent::__construct('label', $label);
19
    }
20
21
    /**
22
     * The HTML representation of this element
23
     *
24
     * @return string
25
     */
26
    public function toHTML()
27
    {
28
        return '<label ' . buildAttributes($this->attrs()) . '>' . $this->val() . '</label>';
0 ignored issues
show
Bug introduced by
It seems like $this->attrs() targeting dokuwiki\Form\Element::attrs() can also be of type this<dokuwiki\Form\LabelElement>; however, buildAttributes() does only seem to accept array, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
29
    }
30
}
31