PaymentItem::getVatAmount()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
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
}