RadioComponent::checked()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Lagdo\UiBuilder\Component\Base;
4
5
use Lagdo\UiBuilder\Component\HtmlComponent;
6
7
class RadioComponent extends HtmlComponent
8
{
9
    use Traits\InputLabelTrait;
10
    use Traits\InputValidationTrait;
11
12
    /**
13
     * @var string
14
     */
15
    public static string $tag = 'input';
16
17
    /**
18
     * @param bool $checked
19
     *
20
     * @return static
21
     */
22
    public function checked(bool $checked = false): static
23
    {
24
        $this->element()->setAttribute('checked', $checked ? 'checked' : false);
25
        return $this;
26
    }
27
}
28