Code Duplication    Length = 15-18 lines in 2 locations

src/Fields/IntField.php 1 location

@@ 32-49 (lines=18) @@
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function renderInput(InputRenderer $renderer, InputModel $model, array $attr)
33
    {
34
        $defaults = [];
35
36
        if ($this->max_length) {
37
            $defaults['maxlength'] = $this->max_length;
38
        }
39
40
        if ($this->min_value) {
41
            $defaults['min'] = $this->min_value;
42
        }
43
44
        if ($this->max_value) {
45
            $defaults['max'] = $this->max_value;
46
        }
47
48
        return $renderer->inputFor($this, 'number', $attr + $defaults);
49
    }
50
    
51
    /**
52
     * @param InputModel $model

src/Fields/TextField.php 1 location

@@ 52-66 (lines=15) @@
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function renderInput(InputRenderer $renderer, InputModel $model, array $attr)
53
    {
54
        $defaults = [];
55
56
        if ($this->max_length) {
57
            $defaults['maxlength'] = $this->max_length;
58
        }
59
60
        if ($this->pattern) {
61
            $defaults['pattern'] = $this->pattern;
62
            $defaults['data-pattern-error'] = $this->pattern_error;
63
        }
64
        
65
        return $renderer->inputFor($this, 'text', $attr + $defaults);
66
    }
67
68
    /**
69
     * @inheritdoc