1 | <?php |
||
15 | abstract class Entry implements EntryInterface |
||
16 | { |
||
17 | const VAT_NONE = 0; |
||
18 | const VAT_EXC = 1; |
||
19 | const VAT_INC = 2; |
||
20 | |||
21 | /** |
||
22 | * @Id |
||
23 | * @Column(type="integer") |
||
24 | * @GeneratedValue |
||
25 | */ |
||
26 | private $id; |
||
27 | |||
28 | /** |
||
29 | * @Column(type="integer") |
||
30 | */ |
||
31 | private $userId; |
||
32 | |||
33 | /** |
||
34 | * @Column(type="datetime") |
||
35 | * @var DateTime |
||
36 | */ |
||
37 | private $date; |
||
38 | |||
39 | /** @Column(type="decimal",precision=11,scale=2) */ |
||
40 | private $amount; |
||
41 | |||
42 | /** |
||
43 | * @Column(type="decimal",precision=11,scale=2) |
||
44 | * @var float $vatRate |
||
45 | */ |
||
46 | private $vatRate; |
||
47 | |||
48 | /** |
||
49 | * @Column(type="decimal",precision=11,scale=2) |
||
50 | * @var float |
||
51 | */ |
||
52 | private $vat; |
||
53 | |||
54 | /** |
||
55 | * @Column(type="decimal",precision=11,scale=2) |
||
56 | * @var float |
||
57 | */ |
||
58 | private $total; |
||
59 | |||
60 | /** @Column(type="string",length=50,nullable=true) */ |
||
61 | private $category; |
||
62 | |||
63 | /** @Column(type="string",length=50,nullable=true) */ |
||
64 | private $description; |
||
65 | |||
66 | /** @Column(type="string",length=255,nullable=true) */ |
||
67 | private $note; |
||
68 | |||
69 | /** |
||
70 | * Entry constructor. |
||
71 | * @param int $vatRate |
||
72 | */ |
||
73 | 16 | public function __construct($vatRate = 0) |
|
80 | |||
81 | /** |
||
82 | * @return int |
||
83 | */ |
||
84 | 4 | public function getId() |
|
88 | |||
89 | /** |
||
90 | * @param int $id |
||
91 | * @return Entry |
||
92 | */ |
||
93 | 7 | public function setId($id) |
|
98 | |||
99 | /** |
||
100 | * @return mixed |
||
101 | */ |
||
102 | 4 | public function getUserId() |
|
106 | |||
107 | /** |
||
108 | * @param mixed $userId |
||
109 | * @return Entry |
||
110 | */ |
||
111 | 7 | public function setUserId($userId) |
|
116 | |||
117 | |||
118 | |||
119 | /** |
||
120 | * @return DateTime |
||
121 | */ |
||
122 | 2 | public function getDate() |
|
126 | |||
127 | /** |
||
128 | * @param DateTime $date |
||
129 | * @return Entry |
||
130 | */ |
||
131 | 7 | public function setDate(DateTime $date) |
|
136 | |||
137 | /** |
||
138 | * @return float |
||
139 | */ |
||
140 | 5 | public function getAmount() |
|
144 | |||
145 | /** |
||
146 | * @param float $amount |
||
147 | * @return Entry |
||
148 | */ |
||
149 | 10 | public function setAmount($amount, $vatPaid = self::VAT_NONE) |
|
180 | |||
181 | /** |
||
182 | * @return Category |
||
183 | */ |
||
184 | 2 | public function getCategory() |
|
188 | |||
189 | /** |
||
190 | * @param Category $category |
||
191 | * @return Entry |
||
192 | */ |
||
193 | 7 | public function setCategory(Category $category) |
|
198 | |||
199 | /** |
||
200 | * @return string |
||
201 | */ |
||
202 | 2 | public function getDescription() |
|
206 | |||
207 | /** |
||
208 | * @param string $description |
||
209 | * @return Entry |
||
210 | */ |
||
211 | 7 | public function setDescription($description) |
|
216 | |||
217 | /** |
||
218 | * @return string |
||
219 | */ |
||
220 | 2 | public function getNote() |
|
224 | |||
225 | /** |
||
226 | * @param string $note |
||
227 | * @return Entry |
||
228 | */ |
||
229 | 7 | public function setNote($note) |
|
234 | |||
235 | /** |
||
236 | * @return float |
||
237 | */ |
||
238 | 4 | public function getVatRate() |
|
242 | |||
243 | /** |
||
244 | * @param float $vatRate |
||
245 | * @return Entry |
||
246 | */ |
||
247 | public function setVatRate($vatRate) |
||
252 | |||
253 | /** |
||
254 | * @return float |
||
255 | */ |
||
256 | 4 | public function getVat() |
|
260 | |||
261 | /** |
||
262 | * @param float $vat |
||
263 | * @return Entry |
||
264 | */ |
||
265 | public function setVat($vat) |
||
270 | |||
271 | /** |
||
272 | * @return float |
||
273 | */ |
||
274 | 4 | public function getTotal() |
|
278 | |||
279 | /** |
||
280 | * @param float $total |
||
281 | * @return Entry |
||
282 | */ |
||
283 | public function setTotal($total) |
||
288 | } |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.