|
@@ -101,7 +101,7 @@ discard block |
|
|
block discarded – undo |
|
101
|
101
|
{ |
|
102
|
102
|
if (is_object($object)) { |
|
103
|
103
|
|
|
104
|
|
- return (array)$object; |
|
|
104
|
+ return (array) $object; |
|
105
|
105
|
} |
|
106
|
106
|
return $object; |
|
107
|
107
|
} |
|
@@ -246,15 +246,15 @@ discard block |
|
|
block discarded – undo |
|
246
|
246
|
} |
|
247
|
247
|
$codeCheckDirectory = FileChangesHelper::checkDirectory($this->dirPathHistoryAppointments); |
|
248
|
248
|
if ($codeCheckDirectory === 'no_directory') { |
|
249
|
|
- $this->logger->error('Path ' . $this->dirPathHistoryAppointments . ' doesn\'t exists.'); |
|
|
249
|
+ $this->logger->error('Path '.$this->dirPathHistoryAppointments.' doesn\'t exists.'); |
|
250
|
250
|
return; |
|
251
|
251
|
} |
|
252
|
252
|
if ($codeCheckDirectory === 'not_readable') { |
|
253
|
|
- $this->logger->error('Path ' . $this->dirPathHistoryAppointments . ' is not readable.'); |
|
|
253
|
+ $this->logger->error('Path '.$this->dirPathHistoryAppointments.' is not readable.'); |
|
254
|
254
|
return; |
|
255
|
255
|
} |
|
256
|
256
|
if ($codeCheckDirectory === 'not_writable') { |
|
257
|
|
- $this->logger->error('Path ' . $this->dirPathHistoryAppointments . ' is not writable.'); |
|
|
257
|
+ $this->logger->error('Path '.$this->dirPathHistoryAppointments.' is not writable.'); |
|
258
|
258
|
return; |
|
259
|
259
|
} |
|
260
|
260
|
$this->lock->acquireLock(); |
|
@@ -268,7 +268,7 @@ discard block |
|
|
block discarded – undo |
|
268
|
268
|
if (!$appointmentsOldHistoryFilePath) { |
|
269
|
269
|
//No files so it's the first time we attempt to synchronize. |
|
270
|
270
|
$appointmentsOld = []; |
|
271
|
|
- } else { |
|
|
271
|
+ }else { |
|
272
|
272
|
//Get the last old appointments data. |
|
273
|
273
|
$appointmentsOldHistory = FileChangesHelper::getJsonContentFromFile($appointmentsOldHistoryFilePath); |
|
274
|
274
|
$appointmentsOld = self::recursiveArrayObjectToFullArray($appointmentsOldHistory); |
|
@@ -278,14 +278,14 @@ discard block |
|
|
block discarded – undo |
|
278
|
278
|
// $listChangings = $this->detectAppointmentsChangings($appointmentsOld, $appointmentsNew, $timestamp); |
|
279
|
279
|
$listChangings = $this->detectAppointmentsChanges($appointmentsOld, $appointmentsNew, $timestamp); |
|
280
|
280
|
if (!$appointmentsOld || ((isset($listChangings['updated']) && !empty($listChangings['updated'])) |
|
281
|
|
- || (isset($listChangings['deleted']) && !empty($listChangings['deleted'])) || (isset($listChangings['inserted']) && !empty($listChangings['inserted'])))) { |
|
|
281
|
+ || (isset($listChangings['deleted']) && !empty($listChangings['deleted'])) || (isset($listChangings['inserted']) && !empty($listChangings['inserted'])))) { |
|
282
|
282
|
//Changes? So we save the new online appointments |
|
283
|
|
- FileChangesHelper::saveAppointmentsFileByHistory($this->dirPathHistoryAppointments . '/appointments_' . $eventCode . '.json', json_encode($appointmentsNew)); |
|
|
283
|
+ FileChangesHelper::saveAppointmentsFileByHistory($this->dirPathHistoryAppointments.'/appointments_'.$eventCode.'.json', json_encode($appointmentsNew)); |
|
284
|
284
|
$this->logger->info('Detect changes - Save Changes'); |
|
285
|
|
- } else { |
|
|
285
|
+ }else { |
|
286
|
286
|
$this->logger->info('Detect changes - No Changes'); |
|
287
|
287
|
} |
|
288
|
|
- FileChangesHelper::saveAppointmentsFileByHistory($this->dirPathHistoryAppointments . '/changes_' . $eventCode . '.json', json_encode($listChangings)); |
|
|
288
|
+ FileChangesHelper::saveAppointmentsFileByHistory($this->dirPathHistoryAppointments.'/changes_'.$eventCode.'.json', json_encode($listChangings)); |
|
289
|
289
|
foreach ($this->listeners as $listener) { |
|
290
|
290
|
//Run Listener. For instance,Here we can use ChangingsToFileListeners to save the changes in file. |
|
291
|
291
|
$listener->run($eventCode, $listChangings); |