Code Duplication    Length = 28-28 lines in 2 locations

system/modules/Ui/objects/ActiveForm/Input/Date.php 1 location

@@ 14-41 (lines=28) @@
11
12
namespace Ui\ActiveForm\Input;
13
14
class Date extends \Ui\ActiveForm\Input {
15
16
    public function draw() {
17
        $inputName = $this->colName();
18
        $inputLabel = $this->colLabel();
19
20
        $inputOptions = $this->options;
21
        if (!empty($inputOptions['minDate'])) {
22
            if (strpos($inputOptions['minDate'], 'col:') === 0) {
23
                $colName = substr($inputOptions['minDate'], 4);
24
                $inputOptions['minDate'] = $this->activeForm->model->{$colName};
25
            }
26
        }
27
        $inputOptions['value'] = $this->value();
28
        $inputOptions['disabled'] = $this->readOnly();
29
30
        $preset = $this->preset();
31
        if ($preset !== null) {
32
            $inputOptions['disabled'] = true;
33
            $this->form->input('hidden', $inputName, '', $inputOptions);
34
            return true;
35
        }
36
        $classPath = explode('\\', get_called_class());
37
        $inputType = lcfirst(array_pop($classPath));
38
        $this->form->input($inputType, $inputName, $inputLabel, $inputOptions);
39
        return true;
40
    }
41
}

system/modules/Ui/objects/ActiveForm/Input/DateTime.php 1 location

@@ 14-41 (lines=28) @@
11
12
namespace Ui\ActiveForm\Input;
13
14
class DateTime extends \Ui\ActiveForm\Input {
15
16
    public function draw() {
17
        $inputName = $this->colName();
18
        $inputLabel = $this->colLabel();
19
20
        $inputOptions = $this->options;
21
        if (!empty($inputOptions['minDate'])) {
22
            if (strpos($inputOptions['minDate'], 'col:') === 0) {
23
                $colName = substr($inputOptions['minDate'], 4);
24
                $inputOptions['minDate'] = $this->activeForm->model->{$colName};
25
            }
26
        }
27
        $inputOptions['value'] = $this->value();
28
        $inputOptions['disabled'] = $this->readOnly();
29
30
        $preset = $this->preset();
31
        if ($preset !== null) {
32
            $inputOptions['disabled'] = true;
33
            $this->form->input('hidden', $inputName, '', $inputOptions);
34
            return true;
35
        }
36
        $classPath = explode('\\', get_called_class());
37
        $inputType = lcfirst(array_pop($classPath));
38
        $this->form->input($inputType, $inputName, $inputLabel, $inputOptions);
39
        return true;
40
    }
41
}