PickUpOrDeliveryModifierOptionsCountry   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 0
loc 37
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 0 23 1
1
<?php
2
3
/**
4
 *@author nicolaas [at] sunnysideup.co.nz
5
 *
6
 **/
7
8
class PickUpOrDeliveryModifierOptionsCountry extends DataExtension
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
9
{
10
    private static $belongs_many_many = array(
0 ignored issues
show
Unused Code introduced by
The property $belongs_many_many is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
11
        "AvailableInCountries" => "PickUpOrDeliveryModifierOptions",
12
    );
13
    private static $many_many = array(
0 ignored issues
show
Unused Code introduced by
The property $many_many is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
14
        "ExcludeFromCountries" => "PickUpOrDeliveryModifierOptions"
15
    );
16
17
    /**
18
     * Update Fields
19
     * @return FieldList
20
     */
21
    public function updateCMSFields(FieldList $fields)
22
    {
23
        $fields->removeFieldFromTab('Root', 'AvailableInCountries');
24
        $fields->removeFieldFromTab('Root', 'ExcludeFromCountries');
25
        $fields->addFieldsToTab(
26
            "Root.Delivery",
27
            array(
28
                new GridField(
29
                    'AvailableInCountries',
30
                    'Included',
31
                    $this->owner->AvailableInCountries(),
32
                    GridFieldConfig_RelationEditor::create()
33
                ),
34
                new GridField(
35
                    'ExcludeFromCountries',
36
                    'Excluded',
37
                    $this->owner->ExcludeFromCountries(),
38
                    GridFieldConfig_RelationEditor::create()
39
                ),
40
            )
41
        );
42
        return $fields;
43
    }
44
}
45