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

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