Code Duplication    Length = 26-26 lines in 2 locations

src/Form/Field/Embeds.php 1 location

@@ 239-264 (lines=26) @@
236
     *
237
     * @return array
238
     */
239
    protected function formatValidationAttribute($input, $label, $column)
240
    {
241
        $new = $attributes = [];
242
243
        if (is_array($column)) {
244
            foreach ($column as $index => $col) {
245
                $new[$col . $index] = $col;
246
            }
247
        }
248
249
        foreach (array_keys(array_dot($input)) as $key) {
250
            if (is_string($column)) {
251
                if (Str::endsWith($key, ".$column")) {
252
                    $attributes[$key] = $label;
253
                }
254
            } else {
255
                foreach ($new as $k => $val) {
256
                    if (Str::endsWith($key, ".$k")) {
257
                        $attributes[$key] = $label . "[$val]";
258
                    }
259
                }
260
            }
261
        }
262
263
        return $attributes;
264
    }
265
266
    /**
267
     * Reset input key for validation.

src/Form/Field/HasMany.php 1 location

@@ 275-300 (lines=26) @@
272
     *
273
     * @return array
274
     */
275
    protected function formatValidationAttribute($input, $label, $column)
276
    {
277
        $new = $attributes = [];
278
279
        if (is_array($column)) {
280
            foreach ($column as $index => $col) {
281
                $new[$col . $index] = $col;
282
            }
283
        }
284
285
        foreach (array_keys(array_dot($input)) as $key) {
286
            if (is_string($column)) {
287
                if (Str::endsWith($key, ".$column")) {
288
                    $attributes[$key] = $label;
289
                }
290
            } else {
291
                foreach ($new as $k => $val) {
292
                    if (Str::endsWith($key, ".$k")) {
293
                        $attributes[$key] = $label . "[$val]";
294
                    }
295
                }
296
            }
297
        }
298
299
        return $attributes;
300
    }
301
302
    /**
303
     * Reset input key for validation.