secondaryThingsToBuild()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 15
nc 1
nop 0
1
<?php
2
3
4
namespace SunnySideUp\BuildDataObject;
5
6
class DataObjectBuildController extends BuildController
7
{
8
    protected $myBaseClass = 'DataObject';
9
10
    protected function additionalPrimaryFields()
11
    {
12
        return [
13
            \HeaderField::create('Model Admin Used'),
14
            \DropdownField::create(
15
                'ModelAdmin',
16
                '',
17
                $this->prependNullOption($this->myAPI()->modelAdminOptions())
18
            )
19
        ];
20
    }
21
22
23 View Code Duplication
    protected function primaryThingsToBuild()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
    {
25
        return $this->addKeysToThingsToBuild([
26
            ['singular_name',       'text',                                      '',                       false],
27
            ['plural_name',         'text',                                      '',                       false],
28
            ['db',                  'text',                                     'dbFields',                true],
29
            ['belongs_to',          'text',                                     'possibleRelations',       true],
30
            ['has_one',             'text',                                     'possibleRelations',       true],
31
            ['has_many',            'text',                                     'possibleRelations',       true],
32
            ['many_many',           'text',                                     'possibleRelations',       true],
33
            ['belongs_many_many',   'text',                                     'possibleRelations',       true]
34
        ]);
35
    }
36
37
    protected function secondaryThingsToBuild()
38
    {
39
        return $this->addKeysToThingsToBuild([
40
            ['defaults',            'myDbFields',                                'text',                   true],
41
            ['default_sort',        'MyDbFieldsWithDefaults',                    'sortOptions',            true],
42
            ['indexes',             'myDbFieldsAndIndexes',                      'indexOptions',           true],
43
            ['required_fields',     'myDbFieldsAndHasOnesWithIDs',               'requiredOptions',        true],
44
            ['field_labels',        'myAllFieldsWithoutBelongs',                 'text',                   true],
45
            ['field_labels_right',  'myAllFieldsWithoutBelongs',                 'text',                   true],
46
            ['searchable_fields',   'myDbFieldsAndHasOnesWithIDs',               'possibleSearchFilters',  true],
47
            ['summary_fields',      'myDbFieldsFancyWithBelongsWithBasicFields', 'text',                   true],
48
            ['casting',             'text',                                      'dbFields',               true],
49
            ['canCreate',           'canOptions',                                '',                       false],
50
            ['canView',             'canOptions',                                '',                       false],
51
            ['canEdit',             'canOptions',                                '',                       false],
52
            ['canDelete',           'canOptions',                                '',                       false]
53
        ]);
54
    }
55
}
56