Code Duplication    Length = 16-26 lines in 2 locations

src/Form/Field/Embeds.php 1 location

@@ 295-310 (lines=16) @@
292
    {
293
        $column = array_flip($column);
294
295
        foreach ($input[$this->column] as $key => $value) {
296
            if (!array_key_exists($key, $column)) {
297
                continue;
298
            }
299
300
            $newKey = $key.$column[$key];
301
302
            /*
303
             * set new key
304
             */
305
            array_set($input, "{$this->column}.$newKey", $value);
306
            /*
307
             * forget the old key and value
308
             */
309
            array_forget($input, "{$this->column}.$key");
310
        }
311
    }
312
313
    /**

src/Form/Field/HasMany.php 1 location

@@ 353-378 (lines=26) @@
350
            /*
351
             * foreach the field set to find the corresponding $column
352
             */
353
            foreach ($set as $name => $value) {
354
                /*
355
                 * if doesn't have column name, continue to the next loop
356
                 */
357
                if (!array_key_exists($name, $column)) {
358
                    continue;
359
                }
360
361
                /**
362
                 * example:  $newKey = created_atstart.
363
                 *
364
                 * Σ( ° △ °|||)︴
365
                 *
366
                 * I don't know why a form need range input? Only can imagine is for range search....
367
                 */
368
                $newKey = $name.$column[$name];
369
370
                /*
371
                 * set new key
372
                 */
373
                array_set($input, "{$this->column}.$index.$newKey", $value);
374
                /*
375
                 * forget the old key and value
376
                 */
377
                array_forget($input, "{$this->column}.$index.$name");
378
            }
379
        }
380
    }
381