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 | 5 | public function getId() |
|
88 | |||
89 | /** |
||
90 | * @param int $id |
||
91 | * @return Entry |
||
92 | */ |
||
93 | 4 | public function setId($id) |
|
98 | |||
99 | /** |
||
100 | * @return mixed |
||
101 | */ |
||
102 | 5 | public function getUserId() |
|
106 | |||
107 | /** |
||
108 | * @param mixed $userId |
||
109 | * @return Entry |
||
110 | */ |
||
111 | 7 | public function setUserId($userId) |
|
116 | |||
117 | /** |
||
118 | * @return DateTime |
||
119 | */ |
||
120 | 3 | public function getDate() |
|
124 | |||
125 | /** |
||
126 | * @param DateTime $date |
||
127 | * @return Entry |
||
128 | */ |
||
129 | 7 | public function setDate(DateTime $date) |
|
134 | |||
135 | /** |
||
136 | * @return float |
||
137 | */ |
||
138 | 7 | public function getAmount() |
|
142 | |||
143 | /** |
||
144 | * @param float $amount |
||
145 | * @return Entry |
||
146 | */ |
||
147 | 10 | public function setAmount($amount, $vatPaid = self::VAT_NONE) |
|
178 | |||
179 | /** |
||
180 | * @return Category |
||
181 | */ |
||
182 | 3 | public function getCategory() |
|
186 | |||
187 | /** |
||
188 | * @param Category $category |
||
189 | * @return Entry |
||
190 | */ |
||
191 | 7 | public function setCategory(Category $category) |
|
196 | |||
197 | /** |
||
198 | * @return string |
||
199 | */ |
||
200 | 3 | public function getDescription() |
|
204 | |||
205 | /** |
||
206 | * @param string $description |
||
207 | * @return Entry |
||
208 | */ |
||
209 | 7 | public function setDescription($description) |
|
214 | |||
215 | /** |
||
216 | * @return string |
||
217 | */ |
||
218 | 3 | public function getNote() |
|
222 | |||
223 | /** |
||
224 | * @param string $note |
||
225 | * @return Entry |
||
226 | */ |
||
227 | 7 | public function setNote($note) |
|
232 | |||
233 | /** |
||
234 | * @return float |
||
235 | */ |
||
236 | 5 | public function getVatRate() |
|
240 | |||
241 | /** |
||
242 | * @param float $vatRate |
||
243 | * @return Entry |
||
244 | */ |
||
245 | 6 | public function setVatRate($vatRate) |
|
250 | |||
251 | /** |
||
252 | * @return float |
||
253 | */ |
||
254 | 6 | public function getVat() |
|
258 | |||
259 | /** |
||
260 | * @return float |
||
261 | */ |
||
262 | 6 | public function getTotal() |
|
266 | } |
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.