1 | <?php |
||
7 | class DetectAppointmentsChangingsService |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * @var AppointmentsCertain |
||
12 | */ |
||
13 | private $appointmentsCertain; |
||
14 | |||
15 | public function __construct(AppointmentsCertain $appointmentsCertain) |
||
19 | |||
20 | /** |
||
21 | * @param $eventCode |
||
22 | * @param null|int $start |
||
23 | * @param null|int $maxResult |
||
24 | * @return mixed |
||
25 | */ |
||
26 | public function getCurrentAppoiments($eventCode,$start=null,$maxResult=null){ |
||
35 | |||
36 | /** |
||
37 | * @param array $appointmentsOld |
||
38 | * @param array $appointmentsNew |
||
39 | * @return bool |
||
40 | */ |
||
41 | public function hasChanged(array $appointmentsOld,array $appointmentsNew){ |
||
63 | |||
64 | /** |
||
65 | * @param $object |
||
66 | * @return array |
||
67 | */ |
||
68 | public static function objectToArray($object) { |
||
75 | |||
76 | /** |
||
77 | * @param $appointments |
||
78 | * @return array |
||
79 | */ |
||
80 | public static function recursiveArrayObjectToFullArray($appointments){ |
||
83 | |||
84 | /** |
||
85 | * @param array $arrayOlds |
||
86 | * @param array $arrayNews |
||
87 | * @return array |
||
88 | */ |
||
89 | private function arrayRecursiveDiff(array $arrayOlds, array $arrayNews) { |
||
98 | |||
99 | /** |
||
100 | * @param array $arrayOlds |
||
101 | * @param array $arrayNews |
||
102 | * @param array $existedUpdateOrDelete |
||
103 | * @return array |
||
104 | */ |
||
105 | private function arrayRecursiveDiffNew(array $arrayOlds, array $arrayNews, array $existedUpdateOrDelete) { |
||
115 | |||
116 | /** |
||
117 | * @param array $appointmentsOld |
||
118 | * @param array $appointmentsNew |
||
119 | * @return array |
||
120 | */ |
||
121 | public function getListChangings(array $appointmentsOld,array $appointmentsNew){ |
||
135 | |||
136 | /** |
||
137 | * |
||
138 | * @param array $currentAppointments |
||
139 | * @param array $changingsDetected |
||
140 | * @return array ['deleted'=>[],'updated'=>[]] |
||
141 | */ |
||
142 | public function detectDeleteOrUpdated(array $currentAppointments, array $changingsDetected){ |
||
171 | |||
172 | /** |
||
173 | * @param array $appointments |
||
174 | * @param $timestamp |
||
175 | * @return array |
||
176 | */ |
||
177 | public static function insertDateTimeChanges(array $appointments,$timestamp){ |
||
183 | |||
184 | /** |
||
185 | * @param array $appointmentsOld |
||
186 | * @param array $appointmentsNew |
||
187 | * @param string $timestamp |
||
188 | * @return array ['deleted'=>[],'updated'=>[]] |
||
189 | */ |
||
190 | public function detectAppointmentsChangings(array $appointmentsOld,array $appointmentsNew,$timestamp){ |
||
198 | |||
199 | } |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: