CountryRegionDeliveryModifier   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 30
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCMSFields() 0 14 1
A TableSubTitle() 0 4 1
A getTableSubTitle() 0 4 1
1
<?php
2
3
/**
4
 * to do: delete this class!
5
 *
6
 *
7
 *
8
 *
9
 *
10
 *
11
 */
12
13
class CountryRegionDeliveryModifier extends PickUpOrDeliveryModifier
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...
14
{
15
16
17
// ######################################## *** cms variables + functions (e.g. getCMSFields, $searchableFields)
18
19
    public function getCMSFields()
20
    {
21
        $fields = parent::getCMSFields();
22
        $fieldLabels = $this->Config()->get("field_labels");
23
        $fields->replaceField(
24
            "CountryCode",
25
            new DropDownField(
26
                "CountryCode",
27
                $fieldLabels["CountryCode"],
28
                EcommerceCountry::get_country_dropdown()
29
            )
30
        );
31
        return $fields;
32
    }
33
34
    public function TableSubTitle()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
35
    {
36
        return $this->getTableSubTitle();
37
    }
38
    public function getTableSubTitle()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
39
    {
40
        return $this->RegionAndCountry;
0 ignored issues
show
Documentation introduced by
The property RegionAndCountry does not exist on object<CountryRegionDeliveryModifier>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
41
    }
42
}
43