Code Duplication    Length = 26-26 lines in 2 locations

src/Form/Field/Embeds.php 1 location

@@ 252-277 (lines=26) @@
249
     *
250
     * @return array
251
     */
252
    protected function formatValidationAttribute($input, $label, $column)
253
    {
254
        $new = $attributes = [];
255
256
        if (is_array($column)) {
257
            foreach ($column as $index => $col) {
258
                $new[$col . $index] = $col;
259
            }
260
        }
261
262
        foreach (array_keys(array_dot($input)) as $key) {
263
            if (is_string($column)) {
264
                if (Str::endsWith($key, ".$column")) {
265
                    $attributes[$key] = $label;
266
                }
267
            } else {
268
                foreach ($new as $k => $val) {
269
                    if (Str::endsWith($key, ".$k")) {
270
                        $attributes[$key] = $label . "[$val]";
271
                    }
272
                }
273
            }
274
        }
275
276
        return $attributes;
277
    }
278
279
    /**
280
     * Reset input key for validation.

src/Form/Field/HasMany.php 1 location

@@ 290-315 (lines=26) @@
287
     *
288
     * @return array
289
     */
290
    protected function formatValidationAttribute($input, $label, $column)
291
    {
292
        $new = $attributes = [];
293
294
        if (is_array($column)) {
295
            foreach ($column as $index => $col) {
296
                $new[$col . $index] = $col;
297
            }
298
        }
299
300
        foreach (array_keys(array_dot($input)) as $key) {
301
            if (is_string($column)) {
302
                if (Str::endsWith($key, ".$column")) {
303
                    $attributes[$key] = $label;
304
                }
305
            } else {
306
                foreach ($new as $k => $val) {
307
                    if (Str::endsWith($key, ".$k")) {
308
                        $attributes[$key] = $label . "[$val]";
309
                    }
310
                }
311
            }
312
        }
313
314
        return $attributes;
315
    }
316
317
    /**
318
     * Reset input key for validation.