Nip_Form_Element_Radio::isChecked()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 1
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
class Nip_Form_Element_Radio extends Nip_Form_Element_Input_Abstract
4
{
5
    protected $_type = 'radio';
6 3
7
    public function init()
8 3
    {
9 3
        parent::init();
10 3
        $this->setAttrib('type', 'radio');
11
    }
12
13
    public function isChecked()
14
    {
15
        return $this->getAttrib('checked') == 'checked';
16
    }
17
18 2
19
    public function setChecked($checked)
20 2
    {
21 2
        if ($checked === true) {
22
            $this->setAttrib('checked', 'checked');
23
        } else {
24
            $this->delAttrib('checked');
25
        }
26 2
27
        return $this;
28
    }
29
}
30