Code Duplication    Length = 23-25 lines in 2 locations

src/Fields/checkbox.php 1 location

@@ 8-32 (lines=25) @@
5
use Code4\Forms\Traits\checkedTrait;
6
use Code4\Forms\Traits\groupFieldTrait;
7
8
class checkbox extends AbstractField {
9
10
    use checkedTrait;
11
    use groupFieldTrait;
12
13
    protected $_view = 'checkbox';
14
    protected $_type = 'checkbox';
15
16
    public function __construct($itemId, $config) {
17
18
        if (array_key_exists('group', $config)) {
19
            $this->group($config['group']);
20
            unset($config['group']);
21
        }
22
23
        parent::__construct($itemId, $config);
24
25
        if (array_key_exists('checked', $config)) {
26
            $this->checked = true;
27
        }
28
29
    }
30
31
32
}

src/Fields/radio.php 1 location

@@ 8-30 (lines=23) @@
5
use Code4\Forms\Traits\checkedTrait;
6
use Code4\Forms\Traits\groupFieldTrait;
7
8
class radio extends AbstractField {
9
10
    use checkedTrait;
11
    use groupFieldTrait;
12
13
    protected $_view = 'radio';
14
    protected $_type = 'radio';
15
16
    public function __construct($itemId, $config) {
17
18
        if (array_key_exists('group', $config)) {
19
            $this->group($config['group']);
20
            unset($config['group']);
21
        }
22
23
        parent::__construct($itemId, $config);
24
25
        if (array_key_exists('checked', $config)) {
26
            $this->checked = true;
27
        }
28
29
    }
30
}