Code Duplication    Length = 29-29 lines in 2 locations

src/Abstractor/Eloquent/Model.php 2 locations

@@ 263-291 (lines=29) @@
260
     *
261
     * @return array
262
     */
263
    public function getListFields($arrayKey = 'main')
264
    {
265
        $columns = $this->getColumns('list');
266
267
        $fieldsPresentation = $this->getConfigValue('fields_presentation') ?: [];
268
269
        $fields = [];
270
        foreach ($columns as $name => $column) {
271
            $presentation = null;
272
            if (array_key_exists($name, $fieldsPresentation)) {
273
                $presentation = $fieldsPresentation[$name];
274
            }
275
276
            $config = [
277
                'name'         => $name,
278
                'presentation' => $presentation,
279
                'form_type'    => null,
280
                'validation'   => null,
281
                'functions'    => null,
282
            ];
283
284
            $fields[$arrayKey][] = $this->fieldFactory
285
                ->setColumn($column)
286
                ->setConfig($config)
287
                ->get();
288
        }
289
290
        return $fields;
291
    }
292
293
    /**
294
     * @param string|null $arrayKey
@@ 300-328 (lines=29) @@
297
     *
298
     * @return array
299
     */
300
    public function getDetailFields($arrayKey = 'main')
301
    {
302
        $columns = $this->getColumns('detail');
303
304
        $fieldsPresentation = $this->getConfigValue('fields_presentation') ?: [];
305
306
        $fields = [];
307
        foreach ($columns as $name => $column) {
308
            $presentation = null;
309
            if (array_key_exists($name, $fieldsPresentation)) {
310
                $presentation = $fieldsPresentation[$name];
311
            }
312
313
            $config = [
314
                'name'         => $name,
315
                'presentation' => $presentation,
316
                'form_type'    => null,
317
                'validation'   => null,
318
                'functions'    => null,
319
            ];
320
321
            $fields[$arrayKey][] = $this->fieldFactory
322
                ->setColumn($column)
323
                ->setConfig($config)
324
                ->get();
325
        }
326
327
        return $fields;
328
    }
329
330
    /**
331
     * @param bool|null   $withForeignKeys