ShippingFrameworkModifier   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 1
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A value() 0 8 4
A TableTitle() 0 12 3
1
<?php
2
3
/**
4
 * @package silvershop-shipping
5
 */
6
class ShippingFrameworkModifier extends ShippingModifier
7
{
8
    public function value($incoming)
9
    {
10
        $order = $this->Order();
0 ignored issues
show
Documentation Bug introduced by
The method Order does not exist on object<ShippingFrameworkModifier>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
11
        if ($order && $order->exists() && $shipping = $order->ShippingMethod()) {
12
            return $shipping->getCalculator($order)->calculate();
13
        }
14
        return 0;
15
    }
16
17
    public function TableTitle()
18
    {
19
        $title = $this->i18n_singular_name();
20
        
21
        if ($this->Order() && $this->Order()->ShippingMethod()->exists()) {
0 ignored issues
show
Documentation Bug introduced by
The method Order does not exist on object<ShippingFrameworkModifier>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
22
            $title .= " (".$this->Order()->ShippingMethod()->Name.")";
0 ignored issues
show
Documentation Bug introduced by
The method Order does not exist on object<ShippingFrameworkModifier>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
23
        }
24
           
25
        $this->extend('updateTableTitle', $title);
26
        
27
        return $title;
28
    }
29
}
30