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

TaxResponse   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 132
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 10
lcom 0
cbo 1
dl 0
loc 132
ccs 29
cts 29
cp 1
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A getTotalAmount() 0 4 1
A getShipping() 0 4 1
A getTaxableAmount() 0 4 1
A getAmountToCollect() 0 4 1
A getRate() 0 4 1
A hasNexus() 0 4 1
A isFreightTaxable() 0 4 1
A getTaxSource() 0 4 1
A getTaxBreakdown() 0 4 1
1
<?php
2
3
namespace LAShowroom\TaxJarBundle\Model\Response;
4
5
class TaxResponse
6
{
7
    /**
8
     * @var float
9
     */
10
    private $totalAmount;
11
12
    /**
13
     * @var float
14
     */
15
    private $shipping;
16
17
    /**
18
     * @var float
19
     */
20
    private $taxableAmount;
21
22
    /**
23
     * @var float
24
     */
25
    private $amountToCollect;
26
27
    /**
28
     * @var float
29
     */
30
    private $rate;
31
32
    /**
33
     * @var bool
34
     */
35
    private $hasNexus;
36
37
    /**
38
     * @var bool
39
     */
40
    private $freightTaxable;
41
42
    /**
43
     * @var string
44
     */
45
    private $taxSource;
46
47
    /**
48
     * @var TaxBreakdown
49
     */
50
    private $taxBreakdown;
51
52 6
    public function __construct(\stdClass $response)
53
    {
54 6
        $this->totalAmount = $response->order_total_amount;
55 6
        $this->shipping = $response->shipping;
56 6
        $this->taxableAmount = $response->taxable_amount;
57 6
        $this->amountToCollect = $response->amount_to_collect;
58 6
        $this->rate = $response->rate;
59 6
        $this->hasNexus = (bool) $response->has_nexus;
60 6
        $this->freightTaxable = (bool) $response->freight_taxable;
61 6
        $this->taxSource = $response->tax_source;
62 6
        $this->taxBreakdown = new TaxBreakdown($response->breakdown);
63 6
    }
64
65
    /**
66
     * @return float
67
     */
68 2
    public function getTotalAmount()
69
    {
70 2
        return $this->totalAmount;
71
    }
72
73
    /**
74
     * @return float
75
     */
76 2
    public function getShipping()
77
    {
78 2
        return $this->shipping;
79
    }
80
81
    /**
82
     * @return float
83
     */
84 2
    public function getTaxableAmount()
85
    {
86 2
        return $this->taxableAmount;
87
    }
88
89
    /**
90
     * @return float
91
     */
92 2
    public function getAmountToCollect()
93
    {
94 2
        return $this->amountToCollect;
95
    }
96
97
    /**
98
     * @return float
99
     */
100 2
    public function getRate()
101
    {
102 2
        return $this->rate;
103
    }
104
105
    /**
106
     * @return bool
107
     */
108 2
    public function hasNexus()
109
    {
110 2
        return $this->hasNexus;
111
    }
112
113
    /**
114
     * @return bool
115
     */
116 2
    public function isFreightTaxable()
117
    {
118 2
        return $this->freightTaxable;
119
    }
120
121
    /**
122
     * @return string
123
     */
124 2
    public function getTaxSource()
125
    {
126 2
        return $this->taxSource;
127
    }
128
129
    /**
130
     * @return TaxBreakdown
131
     */
132 2
    public function getTaxBreakdown()
133
    {
134 2
        return $this->taxBreakdown;
135
    }
136
}
137