Code Duplication    Length = 16-26 lines in 2 locations

src/Form/Field/Embeds.php 1 location

@@ 182-197 (lines=16) @@
179
    {
180
        $column = array_flip($column);
181
182
        foreach ($input[$this->column] as $key => $value) {
183
            if (!array_key_exists($key, $column)) {
184
                continue;
185
            }
186
187
            $newKey = $key.$column[$key];
188
189
            /*
190
             * set new key
191
             */
192
            Arr::set($input, "{$this->column}.$newKey", $value);
193
            /*
194
             * forget the old key and value
195
             */
196
            Arr::forget($input, "{$this->column}.$key");
197
        }
198
    }
199
200
    /**

src/Form/Field/HasMany.php 1 location

@@ 276-301 (lines=26) @@
273
            /*
274
             * foreach the field set to find the corresponding $column
275
             */
276
            foreach ($set as $name => $value) {
277
                /*
278
                 * if doesn't have column name, continue to the next loop
279
                 */
280
                if (!array_key_exists($name, $column)) {
281
                    continue;
282
                }
283
284
                /**
285
                 * example:  $newKey = created_atstart.
286
                 *
287
                 * Σ( ° △ °|||)︴
288
                 *
289
                 * I don't know why a form need range input? Only can imagine is for range search....
290
                 */
291
                $newKey = $name.$column[$name];
292
293
                /*
294
                 * set new key
295
                 */
296
                Arr::set($input, "{$this->column}.$index.$newKey", $value);
297
                /*
298
                 * forget the old key and value
299
                 */
300
                Arr::forget($input, "{$this->column}.$index.$name");
301
            }
302
        }
303
    }
304