Code Duplication    Length = 20-21 lines in 2 locations

src/Form/Field/HasMany.php 1 location

@@ 260-279 (lines=20) @@
257
                }, $newColumn);
258
                $newInputs = $array_clean_merge($newInputs, $newInput);
259
260
                $newAttributes = array_map(function ($v) use ($field, $availInput) {
261
                    list($r, $k, $c) = explode('.', $v);
262
                    //Fix ResetInput Function! A Headache Implementation!
263
                    $col = explode(':', $c)[0];
264
                    if (array_key_exists($col, $availInput[$k]) && is_array($availInput[$k][$col])) {
265
                        return call_user_func_array('array_merge', array_map(function ($u) use ($v, $field) {
266
                            $w = $field->label();
267
                            //Fix ResetInput Function! A Headache Implementation!
268
                            $w .= is_array($field->column()) ? '['.explode(':', explode('.', $v)[2])[0].']' : '';
269
270
                            return ["{$v}:{$u}" => $w];
271
                        }, array_keys($availInput[$k][$col])));
272
                    }
273
274
                    //May Have Problem in Dealing with File Upload in Edit Mode
275
                    $w = $field->label();
276
                    //Fix ResetInput Function! A Headache Implementation!
277
                    $w .= is_array($field->column()) ? '['.explode(':', explode('.', $v)[2])[0].']' : '';
278
279
                    return [$v => $w];
280
                }, $newColumn);
281
                $attributes = $array_clean_merge($attributes, $newAttributes);
282
            }

src/Form/Field/Embeds.php 1 location

@@ 196-216 (lines=21) @@
193
                return !$k ? "{$rel}.{$v}" : "{$rel}.{$v}:{$k}";
194
            }, array_keys($columns), array_values($columns));
195
196
            $newAttributes = array_map(function ($v) use ($field, $availInput) {
197
                list($k, $c) = explode('.', $v);
198
                //Fix ResetInput Function! A Headache Implementation!
199
                $col = explode(':', $c)[0];
200
                if (array_key_exists($col, $availInput[$k]) && is_array($availInput[$k][$col])) {
201
                    return call_user_func_array('array_merge', array_map(function ($u) use ($v, $field) {
202
                        $w = $field->label();
203
                        //Fix ResetInput Function! A Headache Implementation!
204
                        $w .= is_array($field->column()) ? '['.explode(':', explode('.', $v)[2])[0].']' : '';
205
206
                        return ["{$v}:{$u}" => $w];
207
                    }, array_keys($availInput[$k][$col])));
208
                }
209
210
                //May Have Problem in Dealing with File Upload in Edit Mode
211
                $w = $field->label();
212
                //Fix ResetInput Function! A Headache Implementation!
213
                $w .= is_array($field->column()) ? '['.explode(':', explode('.', $v)[2])[0].']' : '';
214
215
                return [$v => $w];
216
            }, $newColumn);
217
            $attributes = $array_clean_merge($attributes, $newAttributes);
218
        }
219