1 | <?php |
||
21 | class RunningBalanceService implements EventManagerAwareInterface |
||
22 | { |
||
23 | |||
24 | use EventManagerAwareTrait; |
||
25 | |||
26 | /** |
||
27 | * @var \DateTime |
||
28 | */ |
||
29 | protected $date; |
||
30 | |||
31 | /** |
||
32 | * @var \JhUser\Repository\UserRepositoryInterface |
||
33 | */ |
||
34 | protected $userRepository; |
||
35 | |||
36 | /** |
||
37 | * @var \JhFlexiTime\Repository\UserSettingRepositoryInterface |
||
38 | */ |
||
39 | protected $userSettingsRepository; |
||
40 | |||
41 | /** |
||
42 | * @var \JhFlexiTime\Repository\BalanceRepositoryInterface |
||
43 | */ |
||
44 | protected $balanceRepository; |
||
45 | |||
46 | /** |
||
47 | * @var \JhFlexiTime\Repository\BookingRepositoryInterface |
||
48 | */ |
||
49 | protected $bookingRepository; |
||
50 | |||
51 | /** |
||
52 | * @var PeriodServiceInterface |
||
53 | */ |
||
54 | protected $periodService; |
||
55 | |||
56 | /** |
||
57 | * @var \DateTime |
||
58 | */ |
||
59 | protected $lastMonth; |
||
60 | |||
61 | /** |
||
62 | * @param UserRepositoryInterface $userRepository |
||
63 | * @param UserSettingsRepositoryInterface $userSettingsRepository |
||
64 | * @param BookingRepositoryInterface $bookingRepository |
||
65 | * @param BalanceRepositoryInterface $balanceRepository |
||
66 | * @param PeriodServiceInterface $periodService |
||
67 | * @param ObjectManager $objectManager |
||
68 | * @param DateTime $date |
||
69 | */ |
||
70 | public function __construct( |
||
90 | |||
91 | /** |
||
92 | * Calculate the previous month balance for all users |
||
93 | * and add it to their running balance |
||
94 | */ |
||
95 | public function indexPreviousMonthBalance() |
||
119 | |||
120 | /** |
||
121 | * Recalculate all user's running balance |
||
122 | */ |
||
123 | public function reIndexAllUsersRunningBalance() |
||
144 | |||
145 | /** |
||
146 | * Recaulculate Individual user's running balance |
||
147 | * |
||
148 | * @param UserInterface $user |
||
149 | */ |
||
150 | public function reIndexIndividualUserRunningBalance(UserInterface $user) |
||
169 | |||
170 | /** |
||
171 | * @param UserInterface $user |
||
172 | * @param float $balance |
||
173 | */ |
||
174 | public function setUserStartingBalance(UserInterface $user, $balance) |
||
180 | |||
181 | /** |
||
182 | * @param UserInterface $user |
||
183 | * @param RunningBalance $runningBalance |
||
184 | * @param array $months |
||
185 | * @param int $initialBalance |
||
186 | */ |
||
187 | private function reIndexRunningBalance( |
||
203 | |||
204 | /** |
||
205 | * @param UserInterface $user |
||
206 | * @param RunningBalance $runningBalance |
||
207 | * @param $month |
||
208 | */ |
||
209 | private function addMonthBalance(UserInterface $user, RunningBalance $runningBalance, array $month) |
||
218 | |||
219 | /** |
||
220 | * Calculate the balance between the two dates |
||
221 | * |
||
222 | * @param UserInterface $user |
||
223 | * @param DateTime $start |
||
224 | * @param DateTime $end |
||
225 | * @return float |
||
226 | */ |
||
227 | private function calculateBalance(UserInterface $user, DateTime $start, DateTime $end) |
||
234 | |||
235 | /** |
||
236 | * @param DateTime $start |
||
237 | * @param DateTime $end |
||
238 | * @return array |
||
239 | */ |
||
240 | private function getMonthRange(DateTime $start, DateTime $end) |
||
256 | } |
||
257 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..