Passed
Branch master (f497d2)
by Mike
03:18
created
lib/core/changesmemorywrapper.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,8 +86,7 @@  discard block
 block discarded – undo
86 86
 						SLog::Write(LOGLEVEL_INFO, sprintf("ChangesMemoryWrapper->Config(AdditionalFolders) : previously synchronized folder '%s' is not to be synched anymore. Sending delete to mobile.", $folder->displayname));
87 87
 						$this->ImportFolderDeletion($folder);
88 88
 					}
89
-				}
90
-				else {
89
+				} else {
91 90
 					$folderIdsOnClient[] = $sid;
92 91
 				}
93 92
 			}
@@ -187,8 +186,7 @@  discard block
 block discarded – undo
187 186
 	public function ImportMessageDeletion($id, $asSoftDelete = false) {
188 187
 		if ($asSoftDelete === true) {
189 188
 			$this->changes[] = [self::SOFTDELETION, $id];
190
-		}
191
-		else {
189
+		} else {
192 190
 			$this->changes[] = [self::DELETION, $id];
193 191
 		}
194 192
 
Please login to merge, or discard this patch.
lib/core/interprocessdata.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@  discard block
 block discarded – undo
36 36
 			// this method is not suitable for the TopCollector atm
37 37
 			$type = Request::GetDeviceID();
38 38
 			$this->ipcProvider = GSync::GetRedis();
39
-		}
40
-		catch (Exception $e) {
39
+		} catch (Exception $e) {
41 40
 			// ipcProvider could not initialise
42 41
 			SLog::Write(LOGLEVEL_ERROR, sprintf("%s could not initialise IPC Redis provider: %s", get_class($this), $e->getMessage()));
43 42
 		}
@@ -193,8 +192,7 @@  discard block
 block discarded – undo
193 192
 		elseif ($doCas == "replace") {
194 193
 			if (!$rawdata) {
195 194
 				$ok = ($this->ipcProvider->get()->hset($key, $compKey, json_encode($data)) !== false);
196
-			}
197
-			else {
195
+			} else {
198 196
 				$ok = $this->ipcProvider->CASHash($key, $compKey, $rawdata, json_encode($data));
199 197
 			}
200 198
 		}
@@ -270,8 +268,7 @@  discard block
 block discarded – undo
270 268
 			}
271 269
 			if (!$subkey) {
272 270
 				$_data[$devid][$user] = $_data;
273
-			}
274
-			else {
271
+			} else {
275 272
 				if (!isset($_data[$devid][$user])) {
276 273
 					$_data[$devid][$user] = [];
277 274
 				}
Please login to merge, or discard this patch.
lib/core/asdevice.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -83,8 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
 		if (!$stripHierarchyCache && $this->hierarchyCache !== false && $this->hierarchyCache instanceof ChangesMemoryWrapper) {
85 85
 			$this->hierarchyCache->StripData();
86
-		}
87
-		else {
86
+		} else {
88 87
 			unset($this->hierarchyCache);
89 88
 		}
90 89
 
@@ -245,8 +244,7 @@  discard block
 block discarded – undo
245 244
 							$foundMessage = true;
246 245
 							if (count($this->ignoredMessageIds[$folderid]) == 1) {
247 246
 								unset($this->ignoredMessageIds[$folderid]);
248
-							}
249
-							else {
247
+							} else {
250 248
 								unset($this->ignoredMessageIds[$folderid][array_search($id, $this->ignoredMessageIds[$folderid])]);
251 249
 							}
252 250
 
@@ -314,8 +312,7 @@  discard block
 block discarded – undo
314 312
 		if ($hierarchydata !== false && $hierarchydata instanceof ChangesMemoryWrapper) {
315 313
 			$this->hierarchyCache = $hierarchydata;
316 314
 			$this->hierarchyCache->CopyOldState();
317
-		}
318
-		else {
315
+		} else {
319 316
 			$this->hierarchyCache = new ChangesMemoryWrapper();
320 317
 		}
321 318
 
@@ -407,8 +404,7 @@  discard block
 block discarded – undo
407 404
 				$this->backend2folderidCache = false;
408 405
 			}
409 406
 			$this->changed = true;
410
-		}
411
-		else {
407
+		} else {
412 408
 			$contentData = $this->contentData;
413 409
 
414 410
 			if (!isset($contentData[$folderid])) {
@@ -422,8 +418,7 @@  discard block
 block discarded – undo
422 418
 
423 419
 			if ($uuid) {
424 420
 				$contentData[$folderid]->{self::FOLDERUUID} = $uuid;
425
-			}
426
-			else {
421
+			} else {
427 422
 				$contentData[$folderid]->{self::FOLDERUUID} = false;
428 423
 			}
429 424
 
@@ -678,8 +673,7 @@  discard block
 block discarded – undo
678 673
 		}
679 674
 		if ($status !== false) {
680 675
 			$contentData[$folderid]->{self::FOLDERSYNCSTATUS} = $status;
681
-		}
682
-		elseif (isset($contentData[$folderid]->{self::FOLDERSYNCSTATUS})) {
676
+		} elseif (isset($contentData[$folderid]->{self::FOLDERSYNCSTATUS})) {
683 677
 			unset($contentData[$folderid]->{self::FOLDERSYNCSTATUS});
684 678
 		}
685 679
 
@@ -939,8 +933,7 @@  discard block
 block discarded – undo
939 933
 		foreach ($this->additionalfolders as $keepFolder) {
940 934
 			if ($keepFolder['store'] !== $store) {
941 935
 				$newAF[$keepFolder['folderid']] = $keepFolder;
942
-			}
943
-			else {
936
+			} else {
944 937
 				$noDupsCheck[$keepFolder['folderid']] = true;
945 938
 			}
946 939
 		}
Please login to merge, or discard this patch.
lib/core/loopdetection.php 1 patch
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -264,8 +264,7 @@  discard block
 block discarded – undo
264 264
 					if (isset($se['stat'], $se['stat']['hierarchy']) && $se['stat']['hierarchy'] == SYNC_FSSTATUS_SYNCKEYERROR) {
265 265
 						SLog::Write(LOGLEVEL_DEBUG, "LoopDetection->ProcessLoopDetectionIsHierarchyResyncRequired(): a full FolderReSync was already requested. Resetting fail counter.");
266 266
 						$seenFailed = [];
267
-					}
268
-					else {
267
+					} else {
269 268
 						$seenFolderSync = true;
270 269
 						if (!empty($seenFailed)) {
271 270
 							SLog::Write(LOGLEVEL_DEBUG, "LoopDetection->ProcessLoopDetectionIsHierarchyResyncRequired(): seen FolderSync after other failing command");
@@ -355,8 +354,7 @@  discard block
 block discarded – undo
355 354
 			foreach ($stack as $entry) {
356 355
 				if ($entry['id'] != $updateentry['id']) {
357 356
 					$nstack[] = $entry;
358
-				}
359
-				else {
357
+				} else {
360 358
 					$nstack[] = $updateentry;
361 359
 					$found = true;
362 360
 				}
@@ -589,8 +587,7 @@  discard block
 block discarded – undo
589 587
 			if (!isset($current["uuid"]) || $current["uuid"] != $uuid) {
590 588
 				SLog::Write(LOGLEVEL_DEBUG, "LoopDetection->IsSyncStateObsolete(): yes, uuid changed or not set");
591 589
 				$obsolete = true;
592
-			}
593
-			else {
590
+			} else {
594 591
 				SLog::Write(LOGLEVEL_DEBUG, sprintf(
595 592
 					"LoopDetection->IsSyncStateObsolete(): check folderid: '%s' uuid '%s' counter: %d - last counter: %d with %d queued",
596 593
 					$folderid,
@@ -610,8 +607,7 @@  discard block
 block discarded – undo
610 607
 					$obsolete = true;
611 608
 				}
612 609
 			}
613
-		}
614
-		else {
610
+		} else {
615 611
 			SLog::Write(LOGLEVEL_DEBUG, sprintf("LoopDetection->IsSyncStateObsolete(): check folderid: '%s' uuid '%s' counter: %d - no data found: not obsolete", $folderid, $uuid, $counter));
616 612
 		}
617 613
 
@@ -685,8 +681,7 @@  discard block
 block discarded – undo
685 681
 					SLog::Write(LOGLEVEL_DEBUG, "LoopDetection->Detect(): UUID changed and while items where sent to device - forcing loop mode");
686 682
 					$loop = true; // force loop mode
687 683
 					$current['queued'] = $queuedMessages;
688
-				}
689
-				else {
684
+				} else {
690 685
 					$current['queued'] = 0;
691 686
 				}
692 687
 
@@ -747,8 +742,7 @@  discard block
 block discarded – undo
747 742
 							// return suggested new window size
748 743
 							$current['windowLimit'] = 25;
749 744
 							$loop = $current['windowLimit'];
750
-						}
751
-						else {
745
+						} else {
752 746
 							// case 3.1) we have just encountered a loop!
753 747
 							SLog::Write(LOGLEVEL_DEBUG, "LoopDetection->Detect(): case 3.1 detected - loop detected, init loop mode");
754 748
 							if (isset($current['windowLimit'])) {
@@ -760,14 +754,12 @@  discard block
 block discarded – undo
760 754
 							$current['maxCount'] = $counter + (($maxItems < $queuedMessages) ? $maxItems : $queuedMessages);
761 755
 							$loop = true;   // loop mode!!
762 756
 						}
763
-					}
764
-					elseif ($queuedMessages == 0) {
757
+					} elseif ($queuedMessages == 0) {
765 758
 						// case 3.2) there was a loop before but now the changes are GONE
766 759
 						SLog::Write(LOGLEVEL_DEBUG, "LoopDetection->Detect(): case 3.2 detected - changes gone - clearing loop data");
767 760
 						$current['queued'] = 0;
768 761
 						unset($current['loopcount'], $current['ignored'], $current['maxCount'], $current['potential'], $current['windowLimit']);
769
-					}
770
-					else {
762
+					} else {
771 763
 						// case 3.3) still looping the same message! Increase counter
772 764
 						SLog::Write(LOGLEVEL_DEBUG, "LoopDetection->Detect(): case 3.3 detected - in loop mode, increase loop counter");
773 765
 						++$current['loopcount'];
@@ -916,14 +908,11 @@  discard block
 block discarded – undo
916 908
 
917 909
 			if ($user == false && $devid == false) {
918 910
 				$loopdata = [];
919
-			}
920
-			elseif ($user == false && $devid != false) {
911
+			} elseif ($user == false && $devid != false) {
921 912
 				$loopdata[$devid] = [];
922
-			}
923
-			elseif ($user != false && $devid != false) {
913
+			} elseif ($user != false && $devid != false) {
924 914
 				$loopdata[$devid][$user] = [];
925
-			}
926
-			elseif ($user != false && $devid == false) {
915
+			} elseif ($user != false && $devid == false) {
927 916
 				SLog::Write(LOGLEVEL_WARN, sprintf("Not possible to reset loop detection data for user '%s' without a specifying a device id", $user));
928 917
 				$stat = false;
929 918
 			}
Please login to merge, or discard this patch.
lib/core/gsync.php 1 patch
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -178,8 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
 		if (defined('BASE_PATH_CLI') && file_exists(BASE_PATH_CLI)) {
180 180
 			define('REAL_BASE_PATH', BASE_PATH_CLI);
181
-		}
182
-		else {
181
+		} else {
183 182
 			define('REAL_BASE_PATH', BASE_PATH);
184 183
 		}
185 184
 
@@ -212,8 +211,7 @@  discard block
 block discarded – undo
212 211
 			if (LOG_SYSLOG_HOST && LOG_SYSLOG_PORT <= 0) {
213 212
 				throw new FatalMisconfigurationException("LOG_SYSLOG_HOST is defined but the LOG_SYSLOG_PORT does not seem to be valid.");
214 213
 			}
215
-		}
216
-		elseif (strtolower(LOGBACKEND) == 'filelog') {
214
+		} elseif (strtolower(LOGBACKEND) == 'filelog') {
217 215
 			define('LOGBACKEND_CLASS', 'FileLog');
218 216
 			if (!defined('LOGFILEDIR')) {
219 217
 				throw new FatalMisconfigurationException("The LOGFILEDIR is not configured. Check if the config.php file is in place.");
@@ -238,8 +236,7 @@  discard block
 block discarded – undo
238 236
 			// check ownership on the (eventually) just created files
239 237
 			Utils::FixFileOwner(LOGFILE);
240 238
 			Utils::FixFileOwner(LOGERRORFILE);
241
-		}
242
-		else {
239
+		} else {
243 240
 			define('LOGBACKEND_CLASS', LOGBACKEND);
244 241
 		}
245 242
 
@@ -249,8 +246,7 @@  discard block
 block discarded – undo
249 246
 			if (!@date_default_timezone_set(TIMEZONE)) {
250 247
 				throw new FatalMisconfigurationException(sprintf("The configured TIMEZONE '%s' is not valid. Please check supported timezones at http://www.php.net/manual/en/timezones.php", constant('TIMEZONE')));
251 248
 			}
252
-		}
253
-		elseif (!ini_get('date.timezone')) {
249
+		} elseif (!ini_get('date.timezone')) {
254 250
 			date_default_timezone_set('Europe/Vienna');
255 251
 		}
256 252
 
@@ -287,8 +283,7 @@  discard block
 block discarded – undo
287 283
 
288 284
 		if (!defined('SYNC_CONTACTS_MAXPICTURESIZE')) {
289 285
 			define('SYNC_CONTACTS_MAXPICTURESIZE', 49152);
290
-		}
291
-		elseif ((!is_int(SYNC_CONTACTS_MAXPICTURESIZE) || SYNC_CONTACTS_MAXPICTURESIZE < 1)) {
286
+		} elseif ((!is_int(SYNC_CONTACTS_MAXPICTURESIZE) || SYNC_CONTACTS_MAXPICTURESIZE < 1)) {
292 287
 			throw new FatalMisconfigurationException("The SYNC_CONTACTS_MAXPICTURESIZE value must be a number higher than 0.");
293 288
 		}
294 289
 
@@ -298,14 +293,12 @@  discard block
 block discarded – undo
298 293
 
299 294
 		if (!defined('PING_LOWER_BOUND_LIFETIME')) {
300 295
 			define('PING_LOWER_BOUND_LIFETIME', false);
301
-		}
302
-		elseif (PING_LOWER_BOUND_LIFETIME !== false && (!is_int(PING_LOWER_BOUND_LIFETIME) || PING_LOWER_BOUND_LIFETIME < 1 || PING_LOWER_BOUND_LIFETIME > 3540)) {
296
+		} elseif (PING_LOWER_BOUND_LIFETIME !== false && (!is_int(PING_LOWER_BOUND_LIFETIME) || PING_LOWER_BOUND_LIFETIME < 1 || PING_LOWER_BOUND_LIFETIME > 3540)) {
303 297
 			throw new FatalMisconfigurationException("The PING_LOWER_BOUND_LIFETIME value must be 'false' or a number between 1 and 3540 inclusively.");
304 298
 		}
305 299
 		if (!defined('PING_HIGHER_BOUND_LIFETIME')) {
306 300
 			define('PING_HIGHER_BOUND_LIFETIME', false);
307
-		}
308
-		elseif (PING_HIGHER_BOUND_LIFETIME !== false && (!is_int(PING_HIGHER_BOUND_LIFETIME) || PING_HIGHER_BOUND_LIFETIME < 1 || PING_HIGHER_BOUND_LIFETIME > 3540)) {
301
+		} elseif (PING_HIGHER_BOUND_LIFETIME !== false && (!is_int(PING_HIGHER_BOUND_LIFETIME) || PING_HIGHER_BOUND_LIFETIME < 1 || PING_HIGHER_BOUND_LIFETIME > 3540)) {
309 302
 			throw new FatalMisconfigurationException("The PING_HIGHER_BOUND_LIFETIME value must be 'false' or a number between 1 and 3540 inclusively.");
310 303
 		}
311 304
 		if (PING_HIGHER_BOUND_LIFETIME !== false && PING_LOWER_BOUND_LIFETIME !== false && PING_HIGHER_BOUND_LIFETIME < PING_LOWER_BOUND_LIFETIME) {
@@ -314,8 +307,7 @@  discard block
 block discarded – undo
314 307
 
315 308
 		if (!defined('RETRY_AFTER_DELAY')) {
316 309
 			define('RETRY_AFTER_DELAY', 300);
317
-		}
318
-		elseif (RETRY_AFTER_DELAY !== false && (!is_int(RETRY_AFTER_DELAY) || RETRY_AFTER_DELAY < 1)) {
310
+		} elseif (RETRY_AFTER_DELAY !== false && (!is_int(RETRY_AFTER_DELAY) || RETRY_AFTER_DELAY < 1)) {
319 311
 			throw new FatalMisconfigurationException("The RETRY_AFTER_DELAY value must be 'false' or a number greater than 0.");
320 312
 		}
321 313
 
@@ -330,8 +322,7 @@  discard block
 block discarded – undo
330 322
 		// the check on additional folders will not throw hard errors, as this is probably changed on live systems
331 323
 		if (isset($additionalFolders) && !is_array($additionalFolders)) {
332 324
 			SLog::Write(LOGLEVEL_ERROR, "GSync::CheckConfig(): The additional folders synchronization not available as array.");
333
-		}
334
-		else {
325
+		} else {
335 326
 			// check configured data
336 327
 			foreach ($additionalFolders as $af) {
337 328
 				if (!is_array($af) || !isset($af['store']) || !isset($af['folderid']) || !isset($af['name']) || !isset($af['type'])) {
@@ -478,11 +469,9 @@  discard block
 block discarded – undo
478 469
 
479 470
 		if (is_file($subdirbackend)) {
480 471
 			$toLoad = $subdirbackend;
481
-		}
482
-		elseif (is_file($stdbackend)) {
472
+		} elseif (is_file($stdbackend)) {
483 473
 			$toLoad = $stdbackend;
484
-		}
485
-		else {
474
+		} else {
486 475
 			return false;
487 476
 		}
488 477
 
@@ -543,8 +532,7 @@  discard block
 block discarded – undo
543 532
 	public static function GetAdditionalSyncFolderStore($backendid, $noDebug = false) {
544 533
 		if (isset(self::getAddSyncFolders()[$backendid]->Store)) {
545 534
 			$val = self::getAddSyncFolders()[$backendid]->Store;
546
-		}
547
-		else {
535
+		} else {
548 536
 			$val = self::GetDeviceManager()->GetAdditionalUserSyncFolder($backendid);
549 537
 			if (isset($val['store'])) {
550 538
 				$val = $val['store'];
@@ -593,8 +581,7 @@  discard block
 block discarded – undo
593 581
 
594 582
 			if (isset($additionalFolders) && !is_array($additionalFolders)) {
595 583
 				SLog::Write(LOGLEVEL_ERROR, "GSync::getAddSyncFolders() : The additional folders synchronization not available as array.");
596
-			}
597
-			else {
584
+			} else {
598 585
 				foreach ($additionalFolders as $af) {
599 586
 					if (!is_array($af) || !isset($af['store']) || !isset($af['folderid']) || !isset($af['name']) || !isset($af['type'])) {
600 587
 						SLog::Write(LOGLEVEL_ERROR, "GSync::getAddSyncFolders() : the additional folder synchronization is not configured correctly. Missing parameters. Entry will be ignored.");
Please login to merge, or discard this patch.
lib/core/stateobject.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -209,8 +209,7 @@  discard block
 block discarded – undo
209 209
 				$this->data[$prop] = new $val->gsSyncStateClass();
210 210
 				$this->data[$prop]->jsonDeserialize($val);
211 211
 				$this->data[$prop]->postUnserialize();
212
-			}
213
-			elseif (is_object($val)) {
212
+			} elseif (is_object($val)) {
214 213
 				// json_decode converts arrays into objects, convert them back to arrays
215 214
 				$this->data[$prop] = [];
216 215
 				foreach ($val as $k => $v) {
@@ -219,19 +218,16 @@  discard block
 block discarded – undo
219 218
 						// TODO: case should be removed when removing ASDevice backwards compatibility
220 219
 						if (strcasecmp($v->gsSyncStateClass, "ASDevice") == 0) {
221 220
 							$this->data[$prop][$k] = new ASDevice(Request::GetDeviceID(), Request::GetDeviceType(), Request::GetGETUser(), Request::GetUserAgent());
222
-						}
223
-						else {
221
+						} else {
224 222
 							$this->data[$prop][$k] = new $v->gsSyncStateClass();
225 223
 						}
226 224
 						$this->data[$prop][$k]->jsonDeserialize($v);
227 225
 						$this->data[$prop][$k]->postUnserialize();
228
-					}
229
-					else {
226
+					} else {
230 227
 						$this->data[$prop][$k] = $v;
231 228
 					}
232 229
 				}
233
-			}
234
-			else {
230
+			} else {
235 231
 				$this->data[$prop] = $val;
236 232
 			}
237 233
 		}
Please login to merge, or discard this patch.
lib/core/devicemanager.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -74,8 +74,7 @@  discard block
 block discarded – undo
74 74
 			$this->loadDeviceData();
75 75
 
76 76
 			GSync::GetTopCollector()->SetUserAgent($this->device->GetDeviceUserAgent());
77
-		}
78
-		else {
77
+		} else {
79 78
 			throw new FatalNotImplementedException("Can not proceed without a device id.");
80 79
 		}
81 80
 
@@ -165,8 +164,7 @@  discard block
 block discarded – undo
165 164
 					$this->setDeviceUserData($this->type, [self::$user => $this->device], self::$devid, -1, $doCas = "merge");
166 165
 					SLog::Write(LOGLEVEL_DEBUG, "DeviceManager->Save(): Device data saved");
167 166
 				}
168
-			}
169
-			catch (StateNotFoundException $snfex) {
167
+			} catch (StateNotFoundException $snfex) {
170 168
 				SLog::Write(LOGLEVEL_ERROR, "DeviceManager->Save(): Exception: " . $snfex->getMessage());
171 169
 			}
172 170
 		}
@@ -448,8 +446,7 @@  discard block
 block discarded – undo
448 446
 	public function GetWindowSize($folderid, $uuid, $statecounter, $queuedmessages) {
449 447
 		if (isset($this->windowSize[$folderid])) {
450 448
 			$items = $this->windowSize[$folderid];
451
-		}
452
-		else {
449
+		} else {
453 450
 			$items = WINDOW_SIZE_MAX;
454 451
 		} // 512 by default
455 452
 
@@ -460,8 +457,7 @@  discard block
 block discarded – undo
460 457
 		if ($loop !== false) {
461 458
 			if ($loop === true) {
462 459
 				$items = ($items == 0) ? 0 : 1 + ($this->loopdetection->IgnoreNextMessage(false) ? 1 : 0);
463
-			}
464
-			else {
460
+			} else {
465 461
 				// we got a new suggested window size
466 462
 				$items = $loop;
467 463
 				SLog::Write(LOGLEVEL_DEBUG, sprintf("Mobile loop pre stage detected! Forcing smaller window size of %d before entering loop detection mode", $items));
@@ -543,8 +539,7 @@  discard block
 block discarded – undo
543 539
 				// do not limit when the owner or impersonated user is syncing!
544 540
 				if ($origin == DeviceManager::FLD_ORIGIN_USER || $origin == DeviceManager::FLD_ORIGIN_IMPERSONATED) {
545 541
 					SLog::Write(LOGLEVEL_DEBUG, "Not checking for specific sync limit as this is the owner/impersonated user.");
546
-				}
547
-				else {
542
+				} else {
548 543
 					$spKey = false;
549 544
 					$spFilter = false;
550 545
 					// 1. step: check if there is a general limitation for the store
@@ -935,8 +930,7 @@  discard block
 block discarded – undo
935 930
 						SLog::Write(LOGLEVEL_INFO, "Using old style device for this request and updating when concluding");
936 931
 						$device = $device->devices[$_deviceuser];
937 932
 						$device->lastupdatetime = time();
938
-					}
939
-					else {
933
+					} else {
940 934
 						SLog::Write(LOGLEVEL_WARN, sprintf("Could not find '%s' in device state. Dropping previous device state!", $_deviceuser));
941 935
 					}
942 936
 				}
@@ -944,17 +938,14 @@  discard block
 block discarded – undo
944 938
 					$this->device = $device;
945 939
 					$this->device->LoadedDevice();
946 940
 					$this->deviceHash = $deviceHash;
947
-				}
948
-				else {
941
+				} else {
949 942
 					SLog::Write(LOGLEVEL_WARN, "Loaded device is not a device object. Dropping new loaded state and keeping initialized object!");
950 943
 				}
951 944
 				$this->stateManager->SetDevice($this->device);
952 945
 			}
953
-		}
954
-		catch (StateNotFoundException $snfex) {
946
+		} catch (StateNotFoundException $snfex) {
955 947
 			$this->hierarchySyncRequired = true;
956
-		}
957
-		catch (UnavailableException $uaex) {
948
+		} catch (UnavailableException $uaex) {
958 949
 			// This is temporary and can be ignored e.g. in PING - see https://jira.z-hub.io/browse/ZP-1054
959 950
 			// If the hash was not available before we treat it like a StateNotFoundException.
960 951
 			if ($this->deviceHash === false) {
Please login to merge, or discard this patch.
lib/core/statemanager.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@  discard block
 block discarded – undo
101 101
 				if ($data !== false) {
102 102
 					$this->synchedFolders[$folderid] = $data;
103 103
 				}
104
-			}
105
-			catch (StateNotFoundException $ex) {
104
+			} catch (StateNotFoundException $ex) {
106 105
 			}
107 106
 		}
108 107
 
@@ -142,8 +141,7 @@  discard block
 block discarded – undo
142 141
 		if (!isset($synckey) || $synckey == "0" || $synckey == false) {
143 142
 			$this->uuid = $this->getNewUuid();
144 143
 			$this->newStateCounter = 1;
145
-		}
146
-		else {
144
+		} else {
147 145
 			list($uuid, $counter) = self::ParseStateKey($synckey);
148 146
 			$this->uuid = $uuid;
149 147
 			$this->newStateCounter = $counter + 1;
@@ -231,8 +229,7 @@  discard block
 block discarded – undo
231 229
 
232 230
 		try {
233 231
 			return $this->statemachine->GetState($this->device->GetDeviceId(), IStateMachine::FAILSAVE, $this->uuid, $this->oldStateCounter, $this->deleteOldStates);
234
-		}
235
-		catch (StateNotFoundException $snfex) {
232
+		} catch (StateNotFoundException $snfex) {
236 233
 			return false;
237 234
 		}
238 235
 	}
@@ -377,8 +374,7 @@  discard block
 block discarded – undo
377 374
 	public static function UnLinkState(&$device, $folderid, $removeFromDevice = true, $retrieveUUIDFromDevice = true) {
378 375
 		if ($retrieveUUIDFromDevice === true) {
379 376
 			$savedUuid = $device->GetFolderUUID($folderid);
380
-		}
381
-		else {
377
+		} else {
382 378
 			$savedUuid = $retrieveUUIDFromDevice;
383 379
 		}
384 380
 
Please login to merge, or discard this patch.
lib/core/provisioningmanager.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -78,8 +78,7 @@  discard block
 block discarded – undo
78 78
 			$this->policyHash = $d[self::KEY_POLICYHASH];
79 79
 			$this->updatetime = $d[self::KEY_UPDATETIME];
80 80
 			$this->loadtime = time();
81
-		}
82
-		else {
81
+		} else {
83 82
 			$this->policyKey = ASDevice::UNDEFINED;
84 83
 			$this->policyHash = ASDevice::UNDEFINED;
85 84
 			$this->updatetime = 0;
@@ -122,8 +121,7 @@  discard block
 block discarded – undo
122 121
 			if ($this->policyHash !== ASDevice::UNDEFINED && $this->policyHash != $policyHash) {
123 122
 				$p = true;
124 123
 				SLog::Write(LOGLEVEL_INFO, sprintf("ProvisioningManager->ProvisioningRequired(): saved policy hash '%s' changed to '%s'. Provisioning required.", $this->policyHash, $policyHash));
125
-			}
126
-			elseif (!$noDebug) {
124
+			} elseif (!$noDebug) {
127 125
 				SLog::Write(LOGLEVEL_DEBUG, sprintf("ProvisioningManager->ProvisioningRequired() saved policy hash '%s' matches", $policyHash));
128 126
 			}
129 127
 		}
@@ -185,8 +183,7 @@  discard block
 block discarded – undo
185 183
 				if ($status >= SYNC_PROVISION_RWSTATUS_PENDING) {
186 184
 					SLog::Write(LOGLEVEL_INFO, sprintf("ProvisioningManager->GetProvisioningWipeStatus(): REMOTE WIPE due for user '%s' on device '%s' - status: '%s'", self::$user, self::$devid, $status));
187 185
 					$status = SYNC_PROVISION_RWSTATUS_PENDING;
188
-				}
189
-				else {
186
+				} else {
190 187
 					SLog::Write(LOGLEVEL_INFO, sprintf("ProvisioningManager->GetProvisioningWipeStatus(): no remote wipe pending - status: '%s'", $status));
191 188
 				}
192 189
 			}
Please login to merge, or discard this patch.