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) |
|
23 | { |
||
24 | 6 | $this->vatRate = $vatRate; |
|
|
|||
25 | 6 | $this->repository = $repository; |
|
26 | 6 | } |
|
27 | |||
28 | /** |
||
29 | * @return EntryRepository |
||
30 | */ |
||
31 | 3 | private function getRepository() |
|
32 | { |
||
33 | 3 | return $this->repository; |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param array $data |
||
38 | * @param EntryInterface $entry |
||
39 | * @return EntryInterface |
||
40 | */ |
||
41 | 6 | private function setFromArray(array $data, EntryInterface $entry) |
|
55 | |||
56 | /** |
||
57 | * @return Expenditure |
||
58 | */ |
||
59 | 4 | public function createExpenditureFromArray(array $data) |
|
66 | |||
67 | /** |
||
68 | * @return Income |
||
69 | */ |
||
70 | 3 | public function createIncomeFromArray(array $data) |
|
77 | |||
78 | /** |
||
79 | * Pass an Income, Expenditure, or Expense Claim |
||
80 | * @return array |
||
81 | */ |
||
82 | 1 | public function toArray(EntryInterface $entry) |
|
94 | |||
95 | /** |
||
96 | * @param Income $income |
||
97 | * @return Income |
||
98 | */ |
||
99 | 2 | public function saveIncome(Income $income) |
|
103 | |||
104 | /** |
||
105 | * @param Income $income |
||
106 | */ |
||
107 | 2 | public function deleteIncome(Income $income) |
|
111 | |||
112 | /** |
||
113 | * @param $id |
||
114 | * @return Income |
||
115 | */ |
||
116 | 1 | public function findIncomeById($id) |
|
122 | |||
123 | /** |
||
124 | * @param Expenditure $expenditure |
||
125 | * @return Expenditure |
||
126 | */ |
||
127 | 2 | public function saveExpenditure(Expenditure $expenditure) |
|
131 | |||
132 | /** |
||
133 | * @param Expenditure $expenditure |
||
134 | */ |
||
135 | 2 | public function deleteExpenditure(Expenditure $expenditure) |
|
139 | |||
140 | /** |
||
141 | * @param $id |
||
142 | * @return Expenditure |
||
143 | */ |
||
144 | 1 | public function findExpenditureById($id) |
|
150 | |||
151 | /** |
||
152 | * @param EntryCriteria $criteria |
||
153 | * @return array |
||
154 | */ |
||
155 | 1 | public function findByCriteria(EntryCriteria $criteria) |
|
159 | |||
160 | /** |
||
161 | * @param EntryInterface $entry |
||
162 | */ |
||
163 | 3 | public function deleteEntry(EntryInterface $entry) |
|
167 | |||
168 | /** |
||
169 | * @return float |
||
170 | */ |
||
171 | public function getVatRate() |
||
175 | |||
176 | /** |
||
177 | * @param float $vatRate |
||
178 | * @return ExpensesService |
||
179 | */ |
||
180 | public function setVatRate($vatRate) |
||
185 | } |
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.