1 | <?php |
||
14 | class ExpensesService |
||
15 | { |
||
16 | /** @var float $vatRate */ |
||
17 | private $vatRate; |
||
18 | |||
19 | /** @var EntryRepository $repository */ |
||
20 | protected $repository; |
||
21 | |||
22 | 6 | public function __construct(EntryRepository $repository, $vatRate = 20) |
|
27 | |||
28 | /** |
||
29 | * @return EntryRepository |
||
30 | */ |
||
31 | 3 | private function getRepository() |
|
35 | |||
36 | /** |
||
37 | * @param array $data |
||
38 | * @param EntryInterface $entry |
||
39 | * @return EntryInterface |
||
40 | */ |
||
41 | 6 | private function setFromArray(array $data, EntryInterface $entry) |
|
56 | |||
57 | /** |
||
58 | * @return Expenditure |
||
59 | */ |
||
60 | 4 | public function createExpenditureFromArray(array $data) |
|
67 | |||
68 | /** |
||
69 | * @return Income |
||
70 | */ |
||
71 | 3 | public function createIncomeFromArray(array $data) |
|
78 | |||
79 | /** |
||
80 | * Pass an Income, Expenditure, or Expense Claim |
||
81 | * @return array |
||
82 | */ |
||
83 | 1 | public function toArray(EntryInterface $entry) |
|
98 | |||
99 | /** |
||
100 | * @param Income $income |
||
101 | * @return Income |
||
102 | */ |
||
103 | 2 | public function saveIncome(Income $income) |
|
107 | |||
108 | /** |
||
109 | * @param Income $income |
||
110 | */ |
||
111 | 2 | public function deleteIncome(Income $income) |
|
115 | |||
116 | /** |
||
117 | * @param $id |
||
118 | * @return Income |
||
119 | */ |
||
120 | 1 | public function findIncomeById($id) |
|
126 | |||
127 | /** |
||
128 | * @param Expenditure $expenditure |
||
129 | * @return Expenditure |
||
130 | */ |
||
131 | 2 | public function saveExpenditure(Expenditure $expenditure) |
|
135 | |||
136 | /** |
||
137 | * @param Expenditure $expenditure |
||
138 | */ |
||
139 | 2 | public function deleteExpenditure(Expenditure $expenditure) |
|
143 | |||
144 | /** |
||
145 | * @param $id |
||
146 | * @return Expenditure |
||
147 | */ |
||
148 | 1 | public function findExpenditureById($id) |
|
154 | |||
155 | /** |
||
156 | * @param EntryCriteria $criteria |
||
157 | * @return array |
||
158 | */ |
||
159 | 1 | public function findByCriteria(EntryCriteria $criteria) |
|
163 | |||
164 | /** |
||
165 | * @param EntryInterface $entry |
||
166 | */ |
||
167 | 3 | public function deleteEntry(EntryInterface $entry) |
|
171 | |||
172 | /** |
||
173 | * @return float |
||
174 | */ |
||
175 | public function getVatRate() |
||
179 | |||
180 | /** |
||
181 | * @param float $vatRate |
||
182 | * @return ExpensesService |
||
183 | */ |
||
184 | public function setVatRate($vatRate) |
||
189 | } |
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.