Code Duplication    Length = 20-21 lines in 2 locations

src/Form/Field/Embeds.php 1 location

@@ 166-186 (lines=21) @@
163
            }, $newColumn);
164
            $newInputs = $array_clean_merge($newInputs, $newInput);
165
166
            $newAttributes = array_map(function ($v) use ($field, $availInput) {
167
                list($k, $c) = explode('.', $v);
168
                //Fix ResetInput Function! A Headache Implementation!
169
                $col = explode(':', $c)[0];
170
                if (array_key_exists($col, $availInput[$k]) && is_array($availInput[$k][$col])) {
171
                    return call_user_func_array('array_merge', array_map(function ($u) use ($v, $field) {
172
                        $w = $field->label();
173
                        //Fix ResetInput Function! A Headache Implementation!
174
                        $w .= is_array($field->column()) ? '[' . explode(':', explode('.', $v)[2])[0] . ']' : '';
175
176
                        return ["{$v}:{$u}" => $w];
177
                    }, array_keys($availInput[$k][$col])));
178
                }
179
180
                //May Have Problem in Dealing with File Upload in Edit Mode
181
                $w = $field->label();
182
                //Fix ResetInput Function! A Headache Implementation!
183
                $w .= is_array($field->column()) ? '[' . explode(':', explode('.', $v)[2])[0] . ']' : '';
184
185
                return [$v => $w];
186
            }, $newColumn);
187
            $attributes = $array_clean_merge($attributes, $newAttributes);
188
189
            if ($field->validationMessages) {

src/Form/Field/HasMany.php 1 location

@@ 196-215 (lines=20) @@
193
            }, $newColumn);
194
            $newInputs = $array_clean_merge($newInputs, $newInput);
195
196
            $newAttributes = array_map(function ($v) use ($field, $availInput) {
197
                list($r, $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