Code Duplication    Length = 29-29 lines in 2 locations

src/Abstractor/Eloquent/Model.php 2 locations

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