Code Duplication    Length = 18-18 lines in 2 locations

src/Form/NestedForm.php 1 location

@@ 302-319 (lines=18) @@
299
     *
300
     * @return array|mixed
301
     */
302
    protected function fetchColumnValue($data, $columns)
303
    {
304
        if (is_string($columns)) {
305
            return Arr::get($data, $columns);
306
        }
307
308
        if (is_array($columns)) {
309
            $value = [];
310
            foreach ($columns as $name => $column) {
311
                if (!Arr::has($data, $column)) {
312
                    continue;
313
                }
314
                $value[$name] = Arr::get($data, $column);
315
            }
316
317
            return $value;
318
        }
319
    }
320
321
    /**
322
     * @param Field $field

src/Form.php 1 location

@@ 990-1007 (lines=18) @@
987
     *
988
     * @return array|mixed
989
     */
990
    protected function getDataByColumn($data, $columns)
991
    {
992
        if (is_string($columns)) {
993
            return Arr::get($data, $columns);
994
        }
995
996
        if (is_array($columns)) {
997
            $value = [];
998
            foreach ($columns as $name => $column) {
999
                if (!Arr::has($data, $column)) {
1000
                    continue;
1001
                }
1002
                $value[$name] = Arr::get($data, $column);
1003
            }
1004
1005
            return $value;
1006
        }
1007
    }
1008
1009
    /**
1010
     * Find field object by column.