Code Duplication    Length = 16-26 lines in 2 locations

src/Form/Field/Embeds.php 1 location

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

src/Form/Field/HasMany.php 1 location

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