Code Duplication    Length = 19-19 lines in 2 locations

src/Form/Field/Embeds.php 1 location

@@ 203-221 (lines=19) @@
200
            }, $newColumn);
201
            $attributes = $array_clean_merge($attributes, $newAttributes);
202
203
            if ($field->validationMessages) {
204
                $newMessages = array_map(function ($v) use ($field, $availInput, $array_key_attach_str) {
205
                    list($k, $c) = explode('.', $v);
206
                    //Fix ResetInput Function! A Headache Implementation!
207
                    $col = explode(':', $c)[0];
208
                    if (!array_key_exists($col, $availInput[$k])) {
209
                        return [null => null];
210
                    }
211
                    if (is_array($availInput[$k][$col])) {
212
                        return call_user_func_array('array_merge', array_map(function ($u)
213
                            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');

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)
244
                            use ($v, $field, $array_key_attach_str) {
245
                            return $array_key_attach_str($field->validationMessages, "{$v}:{$u}");
246
                        }, array_keys($availInput[$k][$col])));
247
                    }
248
249
                    return $array_key_attach_str($field->validationMessages, $v);
250
                }, $newColumn);
251
                $messages = $array_clean_merge($messages, $newMessages);
252
            }
253
        }
254
255
        $rules = array_filter($rules, 'strlen');