Code Duplication    Length = 14-15 lines in 2 locations

htdocs/xoops_lib/Xoops/Form/Checkbox.php 1 location

@@ 45-58 (lines=14) @@
42
     * @param mixed        $value   value(s) to be set on display, either one value or an array of them.
43
     * @param boolean      $inline  true for inline arrangement
44
     */
45
    public function __construct($caption, $name = null, $value = null, $inline = true)
46
    {
47
        if (is_array($caption)) {
48
            parent::__construct($caption);
49
            $this->setIfNotSet(':inline', true);
50
        } else {
51
            parent::__construct([]);
52
            $this->setWithDefaults('caption', $caption, '');
53
            $this->setWithDefaults('name', $name, 'name_error');
54
            $this->set('value', $value);
55
            $this->set(':inline', $inline);
56
        }
57
        $this->set('type', 'checkbox');
58
    }
59
60
    /**
61
     * prepare HTML for output

htdocs/xoops_lib/Xoops/Form/Radio.php 1 location

@@ 37-51 (lines=15) @@
34
     * @param string  $value   Pre-selected value
35
     * @param boolean $inline  true to display inline
36
     */
37
    public function __construct($caption, $name = null, $value = null, $inline = true)
38
    {
39
        if (is_array($caption)) {
40
            parent::__construct($caption);
41
        } else {
42
            parent::__construct([]);
43
            $this->setWithDefaults('caption', $caption, '');
44
            $this->setWithDefaults('name', $name, 'name_error');
45
            $this->set('value', $value);
46
            if ($inline) {
47
                $this->set(':inline');
48
            }
49
        }
50
        $this->set('type', 'radio');
51
    }
52
53
    /**
54
     * Prepare HTML for output