Completed
Push — master ( 2b9bd3...31a468 )
by Nicolaas
01:33
created

PageBuildController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 29.55 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 13
loc 44
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A primaryThingsToBuild() 13 13 1
B secondaryThingsToBuild() 0 25 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
4
namespace SunnySideUp\BuildDataObject;
5
6
class PageBuildController extends BuildController
7
{
8
    protected $myBaseClass = 'Page';
9
10 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...
11
    {
12
        return [
13
            ['singular_name',       'text',                                      '',                       false],
14
            ['plural_name',         'text',                                      '',                       false],
15
            ['db',                  'text',                                     'dbFields',                true],
16
            ['belongs_to',          'text',                                     'possibleRelations',       true],
17
            ['has_one',             'text',                                     'possibleRelations',       true],
18
            ['has_many',            'text',                                     'possibleRelations',       true],
19
            ['many_many',           'text',                                     'possibleRelations',       true],
20
            ['belongs_many_many',   'text',                                     'possibleRelations',       true]
21
        ];
22
    }
23
24
    protected function secondaryThingsToBuild()
25
    {
26
        return [
27
            ['description',         'text',                                      '',                       false],
28
            ['can_create',          'TrueOrFalseList',                           '',                       false],
29
            ['can_be_root',         'TrueOrFalseList',                           '',                       false],
30
            ['allowed_children',    'allowedChildrenOptions',                    '',                       true],
31
            ['default_child',       'SiteTreeList',                              '',                       false],
32
            ['default_parent',      'SiteTreeList',                              '',                       false],
33
            ['hide_ancestor',       'SiteTreeList',                              '',                       false],
34
            ['defaults',            'myDbFields',                                'text',                   true],
35
            ['default_sort',        'MyDbFieldsWithDefaults',                    'sortOptions',            true],
36
            ['indexes',             'myDbFieldsAndIndexes',                      'indexOptions',           true],
37
            ['required_fields',     'myDbFieldsAndHasOnesWithIDs',               'requiredOptions',        true],
38
            ['field_labels',        'myAllFieldsWithoutBelongs',                 'text',                   true],
39
            ['field_labels_right',  'myAllFieldsWithoutBelongs',                 'text',                   true],
40
            ['searchable_fields',   'myDbFieldsAndHasOnesWithIDs',               'possibleSearchFilters',  true],
41
            ['summary_fields',      'myDbFieldsFancyWithBelongsWithBasicFields', 'text',                   true],
42
            ['casting',             'text',                                      'dbFields',               true],
43
            ['canCreate',           'canOptions',                                '',                       false],
44
            ['canView',             'canOptions',                                '',                       false],
45
            ['canEdit',             'canOptions',                                '',                       false],
46
            ['canDelete',           'canOptions',                                '',                       false]
47
        ];
48
    }
49
}
50