Code Duplication    Length = 10-15 lines in 6 locations

app/Services/Html/BlenderFormBuilder.php 6 locations

@@ 39-48 (lines=10) @@
36
        return Html::error($this->errors->first($name));
37
    }
38
39
    public function text(string $name, bool $required = false, string $locale = ''): string
40
    {
41
        $fieldName = $this->fieldName($name, $locale);
42
43
        return $this->group([
44
            $this->label($name, $required),
45
            Form::text($fieldName, Form::useInitialValue($this->model, $name, $locale)),
46
            $this->error($fieldName, $this->errors),
47
        ]);
48
    }
49
50
    public function textarea(string $name, bool $required = false, string $locale = ''): string
51
    {
@@ 50-59 (lines=10) @@
47
        ]);
48
    }
49
50
    public function textarea(string $name, bool $required = false, string $locale = ''): string
51
    {
52
        $fieldName = $this->fieldName($name, $locale);
53
54
        return $this->group([
55
            $this->label($name, $required),
56
            Form::textarea($fieldName, Form::useInitialValue($this->model, $name, $locale), ['data-autosize']),
57
            $this->error($fieldName, $this->errors),
58
        ]);
59
    }
60
61
    public function redactor(string $name, bool $required = false, string $locale = ''): string
62
    {
@@ 93-102 (lines=10) @@
90
        return $this->group([el('label.-checkbox', $contents)]);
91
    }
92
93
    public function date(string $name, bool $required = false, string $locale = ''): string
94
    {
95
        $fieldName = $this->fieldName($name, $locale);
96
97
        return $this->group([
98
            $this->label($name, $required),
99
            Form::datePicker($fieldName, Form::useInitialValue($this->model, $name, $locale)),
100
            $this->error($fieldName, $this->errors),
101
        ]);
102
    }
103
104
    public function select(string $name, $options, string $locale = ''): string
105
    {
@@ 104-118 (lines=15) @@
101
        ]);
102
    }
103
104
    public function select(string $name, $options, string $locale = ''): string
105
    {
106
        $fieldName = $this->fieldName($name, $locale);
107
108
        return $this->group([
109
            $this->label($name, true),
110
            Form::select(
111
                $fieldName,
112
                $options,
113
                Form::useInitialValue($this->model, $name, $locale),
114
                ['data-select' => 'select']
115
            ),
116
            $this->error($fieldName, $this->errors),
117
        ]);
118
    }
119
120
    public function searchableSelect(string $name, $options, string $locale = ''): string
121
    {
@@ 120-134 (lines=15) @@
117
        ]);
118
    }
119
120
    public function searchableSelect(string $name, $options, string $locale = ''): string
121
    {
122
        $fieldName = $this->fieldName($name, $locale);
123
124
        return $this->group([
125
            $this->label($name),
126
            Form::select(
127
                $fieldName,
128
                $options,
129
                Form::useInitialValue($this->model, $name, $locale),
130
                ['data-select' => 'search']
131
            ),
132
            $this->error($fieldName, $this->errors),
133
        ]);
134
    }
135
136
    public function searchableMultiSelect(string $name, $options, string $locale = ''): string
137
    {
@@ 136-150 (lines=15) @@
133
        ]);
134
    }
135
136
    public function searchableMultiSelect(string $name, $options, string $locale = ''): string
137
    {
138
        $fieldName = $this->fieldName($name, $locale);
139
140
        return $this->group([
141
            $this->label($name),
142
            Form::select(
143
                $fieldName,
144
                $options,
145
                Form::useInitialValue($this->model, $name, $locale),
146
                ['data-select' => 'search', 'multiple' => true]
147
            ),
148
            $this->error($fieldName, $this->errors),
149
        ]);
150
    }
151
152
    public function tags(string $type): string
153
    {