Code Duplication    Length = 19-19 lines in 2 locations

src/Form/Field/HasMany.php 1 location

@@ 234-252 (lines=19) @@
231
            }, $newColumn);
232
            $attributes = $array_clean_merge($attributes, $newAttributes);
233
234
            if ($field->validationMessages) {
235
                $newMessages = array_map(function ($v) use ($field, $availInput, $array_key_attach_str) {
236
                    list($r, $k, $c) = explode('.', $v);
237
                    //Fix ResetInput Function! A Headache Implementation!
238
                    $col = explode(':', $c)[0];
239
                    if (!array_key_exists($col, $availInput[$k])) {
240
                        return [null => null];
241
                    }
242
                    if (is_array($availInput[$k][$col])) {
243
                        return call_user_func_array('array_merge', array_map(function ($u) use ($v, $field, $array_key_attach_str) {
244
                            return $array_key_attach_str($field->validationMessages, "{$v}:{$u}");
245
                        }, array_keys($availInput[$k][$col])));
246
                    }
247
248
                    return $array_key_attach_str($field->validationMessages, $v);
249
                }, $newColumn);
250
                $messages = $array_clean_merge($messages, $newMessages);
251
            }
252
        }
253
254
        $rules = array_filter($rules, 'strlen');
255
        if (empty($rules)) {

src/Form/Field/Embeds.php 1 location

@@ 204-222 (lines=19) @@
201
            }, $newColumn);
202
            $attributes = $array_clean_merge($attributes, $newAttributes);
203
204
            if ($field->validationMessages) {
205
                $newMessages = array_map(function ($v) use ($field, $availInput, $array_key_attach_str) {
206
                    list($k, $c) = explode('.', $v);
207
                    //Fix ResetInput Function! A Headache Implementation!
208
                    $col = explode(':', $c)[0];
209
                    if (!array_key_exists($col, $availInput[$k])) {
210
                        return [null => null];
211
                    }
212
                    if (is_array($availInput[$k][$col])) {
213
                        return call_user_func_array('array_merge', array_map(function ($u) use ($v, $field, $array_key_attach_str) {
214
                            return $array_key_attach_str($field->validationMessages, "{$v}:{$u}");
215
                        }, array_keys($availInput[$k][$col])));
216
                    }
217
218
                    return $array_key_attach_str($field->validationMessages, $v);
219
                }, $newColumn);
220
                $messages = $array_clean_merge($messages, $newMessages);
221
            }
222
        }
223
224
        $rules = array_filter($rules, 'strlen');
225