Code Duplication    Length = 23-23 lines in 2 locations

src/Form/Field/Embeds.php 1 location

@@ 178-200 (lines=23) @@
175
            }, $newColumn);
176
            $newInputs = $array_clean_merge($newInputs, $newInput);
177
178
            $newAttributes = array_map(function ($v) use ($field, $availInput) {
179
                list($k, $c) = explode('.', $v);
180
                //Fix ResetInput Function! A Headache Implementation!
181
                $col = explode(':', $c)[0];
182
                if (!array_key_exists($col, $availInput[$k])) {
183
                    return [null => null];
184
                }
185
186
                if (is_array($availInput[$k][$col])) {
187
                    return call_user_func_array('array_merge', array_map(function ($u) use ($v, $field) {
188
                        $w = $field->label();
189
                        //Fix ResetInput Function! A Headache Implementation!
190
                        $w .= is_array($field->column()) ? '['.explode(':', explode('.', $v)[2])[0].']' : '';
191
192
                        return ["{$v}:{$u}" => $w];
193
                    }, array_keys($availInput[$k][$col])));
194
                }
195
196
                $w = $field->label();
197
                //Fix ResetInput Function! A Headache Implementation!
198
                $w .= is_array($field->column()) ? '['.explode(':', explode('.', $v)[2])[0].']' : '';
199
200
                return [$v => $w];
201
            }, $newColumn);
202
            $attributes = $array_clean_merge($attributes, $newAttributes);
203

src/Form/Field/HasMany.php 1 location

@@ 209-231 (lines=23) @@
206
            }, $newColumn);
207
            $newInputs = $array_clean_merge($newInputs, $newInput);
208
209
            $newAttributes = array_map(function ($v) use ($field, $availInput) {
210
                list($r, $k, $c) = explode('.', $v);
211
                //Fix ResetInput Function! A Headache Implementation!
212
                $col = explode(':', $c)[0];
213
                if (!array_key_exists($col, $availInput[$k])) {
214
                    return [null => null];
215
                }
216
217
                if (is_array($availInput[$k][$col])) {
218
                    return call_user_func_array('array_merge', array_map(function ($u) use ($v, $field) {
219
                        $w = $field->label();
220
                        //Fix ResetInput Function! A Headache Implementation!
221
                        $w .= is_array($field->column()) ? '['.explode(':', explode('.', $v)[2])[0].']' : '';
222
                        return ["{$v}:{$u}" => $w];
223
                    }, array_keys($availInput[$k][$col])));
224
                }
225
226
                $w = $field->label();
227
                //Fix ResetInput Function! A Headache Implementation!
228
                $w .= is_array($field->column()) ? '['.explode(':', explode('.', $v)[2])[0].']' : '';
229
230
                return [$v => $w];
231
            }, $newColumn);
232
            $attributes = $array_clean_merge($attributes, $newAttributes);
233
234
            if ($field->validationMessages) {