MapMarkerSetsExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 48.39 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 15
loc 31
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 15 18 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
class MapMarkerSetsExtension extends DataExtension
4
{
5
    public static $many_many = array(
6
        'MapMarkerSets' => 'MapMarkerSet',
7
    );
8
9
    public static $belongs_many_many_extraFields = array(
10
        'MapMarkerSets' => array(
11
            'SortOrder' => 'Int',
12
        ),
13
    );
14
15 1 View Code Duplication
    public function updateCMSFields(FieldList $fields)
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...
16
    {
17 1
        $gridConfig2 = GridFieldConfig_RelationEditor::create();
18 1
        $gridConfig2->getComponentByType(
19 1
            'GridFieldAddExistingAutocompleter'
20 1
        )->setSearchFields(
21 1
                array('Title')
22
        );
23 1
        $gridConfig2->getComponentByType('GridFieldPaginator')->setItemsPerPage(100);
24 1
25 1
        $gridField2 = new GridField(
26
            'MapMarkerSets',
27 1
            'MapMarker Sets',
28 1
            $this->owner->MapMarkerSets(),
29 1
            $gridConfig2
30
        );
31 1
        $fields->addFieldToTab('Root.MapMarkerSets', $gridField2);
32
    }
33
}
34