Nip_Form_Element_Radio   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 72.72%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 10
c 1
b 0
f 0
dl 0
loc 25
ccs 8
cts 11
cp 0.7272
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 4 1
A setChecked() 0 9 2
A isChecked() 0 3 1
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