Code Duplication    Length = 16-26 lines in 2 locations

src/Form/Field/Embeds.php 1 location

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

src/Form/Field/HasMany.php 1 location

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