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
            array_set($input, "{$this->column}.$newKey", $value);
193
            /*
194
             * forget the old key and value
195
             */
196
            array_forget($input, "{$this->column}.$key");
197
        }
198
    }
199
200
    /**

src/Form/Field/HasMany.php 1 location

@@ 221-246 (lines=26) @@
218
            /*
219
             * foreach the field set to find the corresponding $column
220
             */
221
            foreach ($set as $name => $value) {
222
                /*
223
                 * if doesn't have column name, continue to the next loop
224
                 */
225
                if (!array_key_exists($name, $column)) {
226
                    continue;
227
                }
228
229
                /**
230
                 * example:  $newKey = created_atstart.
231
                 *
232
                 * Σ( ° △ °|||)︴
233
                 *
234
                 * I don't know why a form need range input? Only can imagine is for range search....
235
                 */
236
                $newKey = $name . $column[$name];
237
238
                /*
239
                 * set new key
240
                 */
241
                array_set($input, "{$this->column}.$index.$newKey", $value);
242
                /*
243
                 * forget the old key and value
244
                 */
245
                array_forget($input, "{$this->column}.$index.$name");
246
            }
247
        }
248
    }
249