Code Duplication    Length = 3-4 lines in 8 locations

src/FormElements/Input.php 1 location

@@ 27-29 (lines=3) @@
24
25
    protected function setPlaceholder()
26
    {
27
        if (isset($this->params['placeholder']) && ! empty($this->params['placeholder'])) {
28
            $this->placeholder = $this->params['placeholder'];
29
        }
30
    }
31
}
32

src/FormElements/Textarea.php 2 locations

@@ 28-30 (lines=3) @@
25
26
    protected function setPlaceholder()
27
    {
28
        if (isset($this->params['placeholder']) && ! empty($this->params['placeholder'])) {
29
            $this->placeholder = $this->params['placeholder'];
30
        }
31
    }
32
33
    protected function setRows()
@@ 35-37 (lines=3) @@
32
33
    protected function setRows()
34
    {
35
        if (isset($this->params['rows']) && ! empty($this->params['rows'])) {
36
            $this->rows = $this->params['rows'];
37
        }
38
    }
39
}
40

src/Form.php 3 locations

@@ 75-77 (lines=3) @@
72
73
    protected function setAction()
74
    {
75
        if (isset($this->params['url']) && ! empty($this->params['url'])) {
76
            $this->action = $this->params['url'];
77
        }
78
    }
79
80
    protected function setMethod()
@@ 87-89 (lines=3) @@
84
85
        // Check method in params
86
87
        if (isset($this->params['method']) && ! empty($this->params['method'])) {
88
            $this->method = $this->httpMethod = $this->params['method'];
89
        }
90
91
        if (in_array(strtoupper($this->method), ['GET', 'POST', 'PUT', 'DELETE'])) {
92
            $this->method = $this->httpMethod = strtoupper($this->method);
@@ 108-111 (lines=4) @@
105
106
    protected function setFiles()
107
    {
108
        if (isset($this->params['files']) && ! empty($this->params['files'])) {
109
            $this->files = $this->params['files'];
110
            $this->enctype = 'multipart/form-data';
111
        }
112
    }
113
114
    protected function setAutocomplete()

src/FormElement.php 2 locations

@@ 108-110 (lines=3) @@
105
106
    protected function setName()
107
    {
108
        if (isset($this->params['name']) && ! empty($this->params['name'])) {
109
            $this->name = $this->id = $this->params['name'];
110
        }
111
    }
112
113
    protected function setLabel()
@@ 116-119 (lines=4) @@
113
    protected function setLabel()
114
    {
115
        // First, check if we receive an explicit label
116
        if (isset($this->params['label']) && ! empty($this->params['label'])) {
117
            $this->label = $this->params['label'];
118
119
            return;
120
        }
121
122
        // Check if we receive a label that is false, so we don't display it