PaymentItem   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getVatAmount() 0 8 2
1
<?php
2
3
namespace BWC\Share\Payment\Model;
4
5
use BWC\Share\Object\DeserializeTrait;
6
7
class PaymentItem
8
{
9
    use DeserializeTrait;
10
11
    /** @var  string */
12
    public $title;
13
14
    /** @var  double */
15
    public $amount;
16
17
    /** @var  double */
18
    public $VATAmount;
19
20
    /** @var  integer */
21
    public $VATPercent;
22
23
    /** @var  string */
24
    public $unit;
25
26
    /** @var  integer */
27
    public $quantity;
28
29
    /** @var  string */
30
    public $iconURL;
31
32
    /**
33
     * @return double
34
     */
35
    public function getVatAmount()
36
    {
37
        if (null === $this->VATAmount) {
38
            return round($this->amount * $this->VATPercent / 100, 2);
39
        } else {
40
            return $this->VATAmount;
41
        }
42
    }
43
}