Code Duplication    Length = 16-26 lines in 2 locations

src/Form/Field/HasMany.php 1 location

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

src/Form/Field/Embeds.php 1 location

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