Passed
Push — master ( 701580...a49358 )
by Thiago
45s
created

Parcel::getStatus()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace MrPrompt\ShipmentCommon\Base;
3
4
use DateTime;
5
6
/**
7
 * Parcel
8
 *
9
 * @author Thiago Paes <[email protected]>
10
 */
11
class Parcel
12
{
13
    /**
14
     *
15
     * @var DateTime
16
     */
17
    private $maturity;
18
19
    /**
20
     *
21
     * @var float
22
     */
23
    private $price;
24
25
    /**
26
     * @var int
27
     */
28
    private $key;
29
30
    /**
31
     * @var int
32
     */
33
    private $quantity;
34
35
    /**
36
     * @var int
37
     */
38
    private $status;
39
40
    /**
41
     * Constructor
42
     * 
43
     * @param DateTime $maturity
44
     * @param float $price
45
     * @param int $key
46
     * @param int $quantity
47
     * @param int $status
48
     */
49 17
    public function __construct(
50
        DateTime $maturity = null,
51
        float $price = 0.00,
52
        int $key = 0,
53
        int $quantity = 1,
54
        int $status = 0
55
    ) {
56 17
        $this->maturity = $maturity ?? new DateTime();
57 17
        $this->price = $price;
58 17
        $this->key = $key;
59 17
        $this->quantity = $quantity;
60 17
        $this->status = $status;
61 17
    }
62
63
    /**
64
     * @return the $maturity
65
     */
66 1
    public function getMaturity(): DateTime
67
    {
68 1
        return $this->maturity;
69
    }
70
71
    /**
72
     * @param \DateTime $maturity
73
     */
74 1
    public function setMaturity(DateTime $maturity)
75
    {
76 1
        $this->maturity = $maturity;
77 1
    }
78
79
    /**
80
     * @return the $price
81
     */
82 1
    public function getPrice(): float
83
    {
84 1
        return $this->price;
85
    }
86
87
    /**
88
     * @param float $price
89
     */
90 1
    public function setPrice(float $price)
91
    {
92 1
        $this->price = $price;
93 1
    }
94
95
    /**
96
     * @return int
97
     */
98 1
    public function getKey(): int
99
    {
100 1
        return $this->key;
101
    }
102
103
    /**
104
     * @param int $key
105
     */
106 1
    public function setKey(int $key = 0)
107
    {
108 1
        $this->key = (int) $key;
109 1
    }
110
111
    /**
112
     * @return int
113
     */
114 1
    public function getQuantity(): int
115
    {
116 1
        return $this->quantity;
117
    }
118
119
    /**
120
     * @param int $quantity
121
     */
122 1
    public function setQuantity(int $quantity = 1)
123
    {
124 1
        $this->quantity = $quantity;
125 1
    }
126
127
    /**
128
     * @return int
129
     */
130 1
    public function getStatus(): int
131
    {
132 1
        return $this->status;
133
    }
134
135
    /**
136
     * @param int $status
137
     */
138 1
    public function setStatus(int $status)
139
    {
140 1
        $this->status = $status;
141 1
    }
142
}
143