Code Duplication    Length = 29-29 lines in 2 locations

src/Abstractor/Eloquent/Model.php 2 locations

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