Completed
Push — master ( 3229d6...c9eeb2 )
by Baldur
03:55
created

LineItem   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 98
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 98
ccs 26
cts 26
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A getId() 0 4 1
A getQuantity() 0 4 1
A getProductTaxCode() 0 4 1
A getUnitPrice() 0 4 1
A getDiscount() 0 4 1
A toArray() 0 10 1
1
<?php
2
3
namespace LAShowroom\TaxJarBundle\Model;
4
5
use Webmozart\Assert\Assert;
6
7
class LineItem
8
{
9
    /**
10
     * @var string
11
     */
12
    private $id;
13
14
    /**
15
     * @var string
16
     */
17
    private $quantity;
18
19
    /**
20
     * @var string
21
     */
22
    private $productTaxCode;
23
24
    /**
25
     * @var float
26
     */
27
    private $unitPrice;
28
29
    /**
30
     * @var float
31
     */
32
    private $discount;
33
34
    /**
35
     * @param string $id
36
     * @param string $quantity
37
     * @param string $productTaxCode
38
     * @param float  $unitPrice
39
     * @param float  $discount
40
     */
41 14
    public function __construct($id, $quantity, $productTaxCode, $unitPrice, $discount)
42
    {
43 14
        Assert::integer($quantity);
44 14
        Assert::float($unitPrice);
45 14
        Assert::float($discount);
46
47 14
        $this->id = $id;
48 14
        $this->quantity = $quantity;
49 14
        $this->productTaxCode = $productTaxCode;
50 14
        $this->unitPrice = $unitPrice;
51 14
        $this->discount = $discount;
52 14
    }
53
54
    /**
55
     * @return string
56
     */
57 12
    public function getId()
58
    {
59 12
        return $this->id;
60
    }
61
62
    /**
63
     * @return string
64
     */
65 12
    public function getQuantity()
66
    {
67 12
        return $this->quantity;
68
    }
69
70
    /**
71
     * @return string
72
     */
73 12
    public function getProductTaxCode()
74
    {
75 12
        return $this->productTaxCode;
76
    }
77
78
    /**
79
     * @return float
80
     */
81 12
    public function getUnitPrice()
82
    {
83 12
        return $this->unitPrice;
84
    }
85
86
    /**
87
     * @return float
88
     */
89 12
    public function getDiscount()
90
    {
91 12
        return $this->discount;
92
    }
93
94 12
    public function toArray()
95
    {
96
        return [
97 12
            'id' => $this->getId(),
98 12
            'quantity' => $this->getQuantity(),
99 12
            'product_tax_code' => $this->getProductTaxCode(),
100 12
            'unit_price' => $this->getUnitPrice(),
101 12
            'discount' => $this->getDiscount(),
102
        ];
103
    }
104
}
105