ShippingFrameworkModifier::value()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.2
c 0
b 0
f 0
cc 4
eloc 5
nc 2
nop 1
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