Code Duplication    Length = 16-27 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

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