Code Duplication    Length = 16-26 lines in 2 locations

src/Form/Field/Embeds.php 1 location

@@ 278-293 (lines=16) @@
275
    {
276
        $column = array_flip($column);
277
278
        foreach ($input[$this->column] as $key => $value) {
279
            if (!array_key_exists($key, $column)) {
280
                continue;
281
            }
282
283
            $newKey = $key . $column[$key];
284
285
            /*
286
             * set new key
287
             */
288
            array_set($input, "{$this->column}.$newKey", $value);
289
            /*
290
             * forget the old key and value
291
             */
292
            array_forget($input, "{$this->column}.$key");
293
        }
294
    }
295
296
    /**

src/Form/Field/HasMany.php 1 location

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