Passed
Branch master (f497d2)
by Mike
03:18
created
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 2 patches
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.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 			throw new StateInvalidException(sprintf("SyncKey '%s' is invalid", $synckey));
420 420
 		}
421 421
 
422
-		return [$matches[1], (int) $matches[2]];
422
+		return [$matches[1], (int)$matches[2]];
423 423
 	}
424 424
 
425 425
 	/**
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
 			mt_rand(0, 0xFFFF),
521 521
 			mt_rand(0, 0xFFFF),
522 522
 			mt_rand(0, 0xFFFF),
523
-			mt_rand(0, 0x0FFF) | 0x4000,
524
-			mt_rand(0, 0x3FFF) | 0x8000,
523
+			mt_rand(0, 0x0FFF)|0x4000,
524
+			mt_rand(0, 0x3FFF)|0x8000,
525 525
 			mt_rand(0, 0xFFFF),
526 526
 			mt_rand(0, 0xFFFF),
527 527
 			mt_rand(0, 0xFFFF)
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.
lib/core/syncparameters.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -121,8 +121,7 @@  discard block
 block discarded – undo
121 121
 		if (!$this->HasSyncKey()) {
122 122
 			$this->uuid = $uuid;
123 123
 			$this->uuidCounter = $uuidNewCounter;
124
-		}
125
-		elseif ($uuid !== $this->uuid) {
124
+		} elseif ($uuid !== $this->uuid) {
126 125
 			throw new FatalException("SyncParameters->SetNewSyncKey(): new SyncKey must have the same UUID as current SyncKey");
127 126
 		}
128 127
 
@@ -290,8 +289,7 @@  discard block
 block discarded – undo
290 289
 		// if the backend returned false as folderstat, we have to run the exporter
291 290
 		if ($currentFolderStat === false || $this->confirmationChanged) {
292 291
 			$run = true;
293
-		}
294
-		else {
292
+		} else {
295 293
 			// check if the folderstat differs from the saved one or expired
296 294
 			$run = !($this->HasFolderStat() && $currentFolderStat === $this->GetFolderStat() && time() < $this->GetFolderStatTimeout());
297 295
 		}
@@ -367,17 +365,13 @@  discard block
 block discarded – undo
367 365
 		if ($options == self::DEFAULTOPTIONS && !isset($this->contentParameters[self::DEFAULTOPTIONS])) {
368 366
 			if (isset($this->contentParameters[self::EMAILOPTIONS])) {
369 367
 				$returnCPO = self::EMAILOPTIONS;
370
-			}
371
-			elseif (isset($this->contentParameters[self::CALENDAROPTIONS])) {
368
+			} elseif (isset($this->contentParameters[self::CALENDAROPTIONS])) {
372 369
 				$returnCPO = self::CALENDAROPTIONS;
373
-			}
374
-			elseif (isset($this->contentParameters[self::CONTACTOPTIONS])) {
370
+			} elseif (isset($this->contentParameters[self::CONTACTOPTIONS])) {
375 371
 				$returnCPO = self::CONTACTOPTIONS;
376
-			}
377
-			elseif (isset($this->contentParameters[self::NOTEOPTIONS])) {
372
+			} elseif (isset($this->contentParameters[self::NOTEOPTIONS])) {
378 373
 				$returnCPO = self::NOTEOPTIONS;
379
-			}
380
-			elseif (isset($this->contentParameters[self::TASKOPTIONS])) {
374
+			} elseif (isset($this->contentParameters[self::TASKOPTIONS])) {
381 375
 				$returnCPO = self::TASKOPTIONS;
382 376
 			}
383 377
 
Please login to merge, or discard this patch.
lib/core/synccollections.php 1 patch
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -60,8 +60,7 @@  discard block
 block discarded – undo
60 60
 			}
61 61
 
62 62
 			return true;
63
-		}
64
-		catch (GSyncException $e) {
63
+		} catch (GSyncException $e) {
65 64
 		}
66 65
 
67 66
 		return false;
@@ -165,8 +164,7 @@  discard block
 block discarded – undo
165 164
 
166 165
 				return true;
167 166
 			}
168
-		}
169
-		catch (StateInvalidException $sive) {
167
+		} catch (StateInvalidException $sive) {
170 168
 			// in case there is something wrong with the state, just stop here
171 169
 			// later when trying to retrieve the SyncParameters nothing will be found
172 170
 
@@ -193,8 +191,7 @@  discard block
 block discarded – undo
193 191
 			try {
194 192
 				// make sure the hierarchy cache is loaded when we are loading hierarchy states
195 193
 				$this->addparms[$folderid]["state"] = $this->stateManager->GetSyncState($spa->GetLatestSyncKey($confirmedOnly), ($folderid === false));
196
-			}
197
-			catch (StateNotFoundException $snfe) {
194
+			} catch (StateNotFoundException $snfe) {
198 195
 				// if we can't find the state, first we should try a sync of that folder, so
199 196
 				// we generate a fake change, so a sync on this folder is triggered
200 197
 				$this->changes[$folderid] = 1;
@@ -387,8 +384,7 @@  discard block
 block discarded – undo
387 384
 		// take the requested global windowsize or the max 512 if not defined
388 385
 		if (isset($this->globalWindowSize)) {
389 386
 			$globalWindowSize = $this->globalWindowSize;
390
-		}
391
-		else {
387
+		} else {
392 388
 			$globalWindowSize = WINDOW_SIZE_MAX; // 512 by default
393 389
 		}
394 390
 
@@ -476,19 +472,16 @@  discard block
 block discarded – undo
476 472
 		}
477 473
 		if (empty($classes)) {
478 474
 			$checkClasses = "policies only";
479
-		}
480
-		elseif (array_sum($classes) > 4) {
475
+		} elseif (array_sum($classes) > 4) {
481 476
 			$checkClasses = "";
482 477
 			foreach ($classes as $class => $count) {
483 478
 				if ($count == 1) {
484 479
 					$checkClasses .= sprintf("%s ", $class);
485
-				}
486
-				else {
480
+				} else {
487 481
 					$checkClasses .= sprintf("%s(%d) ", $class, $count);
488 482
 				}
489 483
 			}
490
-		}
491
-		else {
484
+		} else {
492 485
 			$checkClasses = implode(" ", array_keys($classes));
493 486
 		}
494 487
 
@@ -601,8 +594,7 @@  discard block
 block discarded – undo
601 594
 						if ($this->countHierarchyChange(true)) {
602 595
 							throw new StatusException("SyncCollections->CheckForChanges(): HierarchySync required.", self::HIERARCHY_CHANGED);
603 596
 						}
604
-					}
605
-					else {
597
+					} else {
606 598
 						// the backend will notify on the backend folderid
607 599
 						$folderid = GSync::GetDeviceManager()->GetFolderIdForBackendId($backendFolderId);
608 600
 
@@ -611,8 +603,7 @@  discard block
 block discarded – undo
611 603
 							SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s'", $folderid));
612 604
 							$validNotifications = true;
613 605
 							$this->waitingTime = time() - $started;
614
-						}
615
-						else {
606
+						} else {
616 607
 							SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s', but it is not relevant", $folderid));
617 608
 						}
618 609
 					}
@@ -698,8 +689,7 @@  discard block
 block discarded – undo
698 689
 					$changecount = $exporter->GetChangeCount();
699 690
 				}
700 691
 			}
701
-		}
702
-		catch (StatusException $ste) {
692
+		} catch (StatusException $ste) {
703 693
 			if ($ste->getCode() == SYNC_STATUS_FOLDERHIERARCHYCHANGED) {
704 694
 				SLog::Write(LOGLEVEL_WARN, "SyncCollections->CountChange(): exporter can not be re-configured due to state error, emulating change in folder to force Sync.");
705 695
 				$this->changes[$folderid] = 1;
@@ -767,8 +757,7 @@  discard block
 block discarded – undo
767 757
 
768 758
 					$this->hierarchyExporterChecked = true;
769 759
 				}
770
-			}
771
-			catch (StatusException $ste) {
760
+			} catch (StatusException $ste) {
772 761
 				throw new StatusException("SyncCollections->countHierarchyChange(): exporter can not be re-configured.", self::ERROR_WRONG_HIERARCHY, null, LOGLEVEL_WARN);
773 762
 			}
774 763
 
Please login to merge, or discard this patch.
lib/core/streamimporter.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -90,8 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 		if ($message->flags === false || $message->flags === SYNC_NEWMESSAGE) {
92 92
 			$this->encoder->startTag(SYNC_ADD);
93
-		}
94
-		else {
93
+		} else {
95 94
 			// on update of an SyncEmail we only export the flags and categories
96 95
 			if ($message instanceof SyncMail && ((isset($message->flag) && $message->flag instanceof SyncMailFlags) || isset($message->categories))) {
97 96
 				$newmessage = new SyncMail();
@@ -144,8 +143,7 @@  discard block
 block discarded – undo
144 143
 		++$this->importedMsgs;
145 144
 		if ($asSoftDelete) {
146 145
 			$this->encoder->startTag(SYNC_SOFTDELETE);
147
-		}
148
-		else {
146
+		} else {
149 147
 			$this->encoder->startTag(SYNC_REMOVE);
150 148
 		}
151 149
 		$this->encoder->startTag(SYNC_SERVERENTRYID);
@@ -227,8 +225,7 @@  discard block
 block discarded – undo
227 225
 		// send a modify flag if the folder is already known on the device
228 226
 		if (isset($folder->flags) && $folder->flags === SYNC_NEWMESSAGE) {
229 227
 			$this->encoder->startTag(SYNC_FOLDERHIERARCHY_ADD);
230
-		}
231
-		else {
228
+		} else {
232 229
 			$this->encoder->startTag(SYNC_FOLDERHIERARCHY_UPDATE);
233 230
 		}
234 231
 
Please login to merge, or discard this patch.
lib/core/streamer.php 1 patch
Braces   +26 added lines, -52 removed lines patch added patch discarded remove patch
@@ -70,14 +70,11 @@  discard block
 block discarded – undo
70 70
 					$map = $this->mapping[$entity[EN_TAG]];
71 71
 					if (isset($map[self::STREAMER_ARRAY])) {
72 72
 						$this->{$map[self::STREAMER_VAR]} = [];
73
-					}
74
-					elseif (isset($map[self::STREAMER_PROP]) && $map[self::STREAMER_PROP] == self::STREAMER_TYPE_SEND_EMPTY) {
73
+					} elseif (isset($map[self::STREAMER_PROP]) && $map[self::STREAMER_PROP] == self::STREAMER_TYPE_SEND_EMPTY) {
75 74
 						$this->{$map[self::STREAMER_VAR]} = "1";
76
-					}
77
-					elseif (!isset($map[self::STREAMER_TYPE])) {
75
+					} elseif (!isset($map[self::STREAMER_TYPE])) {
78 76
 						$this->{$map[self::STREAMER_VAR]} = "";
79
-					}
80
-					elseif ($map[self::STREAMER_TYPE] == self::STREAMER_TYPE_DATE || $map[self::STREAMER_TYPE] == self::STREAMER_TYPE_DATE_DASHES) {
77
+					} elseif ($map[self::STREAMER_TYPE] == self::STREAMER_TYPE_DATE || $map[self::STREAMER_TYPE] == self::STREAMER_TYPE_DATE_DASHES) {
81 78
 						$this->{$map[self::STREAMER_VAR]} = "";
82 79
 					}
83 80
 
@@ -107,15 +104,13 @@  discard block
 block discarded – undo
107 104
 							$decoded = new $map[self::STREAMER_TYPE]();
108 105
 
109 106
 							$decoded->Decode($decoder);
110
-						}
111
-						else {
107
+						} else {
112 108
 							$decoded = $decoder->getElementContent();
113 109
 						}
114 110
 
115 111
 						if (!isset($this->{$map[self::STREAMER_VAR]})) {
116 112
 							$this->{$map[self::STREAMER_VAR]} = [$decoded];
117
-						}
118
-						else {
113
+						} else {
119 114
 							array_push($this->{$map[self::STREAMER_VAR]}, $decoded);
120 115
 						}
121 116
 
@@ -144,8 +139,7 @@  discard block
 block discarded – undo
144 139
 							return false;
145 140
 						}
146 141
 					}
147
-				}
148
-				else { // Handle single value
142
+				} else { // Handle single value
149 143
 					if (isset($map[self::STREAMER_TYPE])) {
150 144
 						// Complex type, decode recursively
151 145
 						if ($map[self::STREAMER_TYPE] == self::STREAMER_TYPE_DATE || $map[self::STREAMER_TYPE] == self::STREAMER_TYPE_DATE_DASHES) {
@@ -153,8 +147,7 @@  discard block
 block discarded – undo
153 147
 							if (!$decoder->getElementEndTag()) {
154 148
 								return false;
155 149
 							}
156
-						}
157
-						elseif ($map[self::STREAMER_TYPE] == self::STREAMER_TYPE_HEX) {
150
+						} elseif ($map[self::STREAMER_TYPE] == self::STREAMER_TYPE_HEX) {
158 151
 							$decoded = hex2bin($decoder->getElementContent());
159 152
 							if (!$decoder->getElementEndTag()) {
160 153
 								return false;
@@ -167,14 +160,12 @@  discard block
 block discarded – undo
167 160
 							if (!$decoder->getElementEndTag()) {
168 161
 								return false;
169 162
 							}
170
-						}
171
-						elseif ($map[self::STREAMER_TYPE] == self::STREAMER_TYPE_STREAM_ASPLAIN) {
163
+						} elseif ($map[self::STREAMER_TYPE] == self::STREAMER_TYPE_STREAM_ASPLAIN) {
172 164
 							$decoded = StringStreamWrapper::Open($decoder->getElementContent());
173 165
 							if (!$decoder->getElementEndTag()) {
174 166
 								return false;
175 167
 							}
176
-						}
177
-						else {
168
+						} else {
178 169
 							$subdecoder = new $map[self::STREAMER_TYPE]();
179 170
 							if ($subdecoder->Decode($decoder) === false) {
180 171
 								return false;
@@ -188,8 +179,7 @@  discard block
 block discarded – undo
188 179
 								return false;
189 180
 							}
190 181
 						}
191
-					}
192
-					else {
182
+					} else {
193 183
 						// Simple type, just get content
194 184
 						$decoded = $decoder->getElementContent();
195 185
 
@@ -208,13 +198,11 @@  discard block
 block discarded – undo
208 198
 					// $decoded now contains data object (or string)
209 199
 					$this->{$map[self::STREAMER_VAR]} = $decoded;
210 200
 				}
211
-			}
212
-			elseif ($entity[EN_TYPE] == EN_TYPE_ENDTAG) {
201
+			} elseif ($entity[EN_TYPE] == EN_TYPE_ENDTAG) {
213 202
 				$decoder->ungetElement($entity);
214 203
 
215 204
 				break;
216
-			}
217
-			else {
205
+			} else {
218 206
 				SLog::Write(LOGLEVEL_WBXMLSTACK, "Unexpected content in type");
219 207
 
220 208
 				break;
@@ -243,8 +231,7 @@  discard block
 block discarded – undo
243 231
 						if (!$res && isset($map[self::STREAMER_PROP]) && $map[self::STREAMER_PROP] == self::STREAMER_TYPE_SEND_EMPTY) {
244 232
 							$encoder->startTag($tag, false, true);
245 233
 						}
246
-					}
247
-					else {
234
+					} else {
248 235
 						SLog::Write(LOGLEVEL_ERROR, sprintf("Streamer->Encode(): parameter '%s' of object %s is not of type Streamer", $map[self::STREAMER_VAR], get_class($this)));
249 236
 					}
250 237
 				}
@@ -252,8 +239,7 @@  discard block
 block discarded – undo
252 239
 				elseif (isset($map[self::STREAMER_ARRAY])) {
253 240
 					if (empty($this->{$map[self::STREAMER_VAR]}) && isset($map[self::STREAMER_PROP]) && $map[self::STREAMER_PROP] == self::STREAMER_TYPE_SEND_EMPTY) {
254 241
 						$encoder->startTag($tag, false, true);
255
-					}
256
-					else {
242
+					} else {
257 243
 						// Outputs array container (eg Attachments)
258 244
 						// Do not output start and end tag when type is STREAMER_TYPE_NO_CONTAINER
259 245
 						if (!isset($map[self::STREAMER_PROP]) || $map[self::STREAMER_PROP] != self::STREAMER_TYPE_NO_CONTAINER) {
@@ -265,8 +251,7 @@  discard block
 block discarded – undo
265 251
 								$encoder->startTag($map[self::STREAMER_ARRAY]); // Outputs object container (eg Attachment)
266 252
 								$element->Encode($encoder);
267 253
 								$encoder->endTag();
268
-							}
269
-							else {
254
+							} else {
270 255
 								if (strlen($element) == 0)
271 256
 									  // Do not output empty items. Not sure if we should output an empty tag with $encoder->startTag($map[self::STREAMER_ARRAY], false, true);
272 257
 									  ; else {
@@ -282,8 +267,7 @@  discard block
 block discarded – undo
282 267
 							$encoder->endTag();
283 268
 						}
284 269
 					}
285
-				}
286
-				else {
270
+				} else {
287 271
 					if (isset($map[self::STREAMER_TYPE]) && $map[self::STREAMER_TYPE] == self::STREAMER_TYPE_IGNORE) {
288 272
 						continue;
289 273
 					}
@@ -313,14 +297,11 @@  discard block
 block discarded – undo
313 297
 						if ($this->{$map[self::STREAMER_VAR]} != 0) { // don't output 1-1-1970
314 298
 							$encoder->content($this->formatDate($this->{$map[self::STREAMER_VAR]}, $map[self::STREAMER_TYPE]));
315 299
 						}
316
-					}
317
-					elseif (isset($map[self::STREAMER_TYPE]) && $map[self::STREAMER_TYPE] == self::STREAMER_TYPE_HEX) {
300
+					} elseif (isset($map[self::STREAMER_TYPE]) && $map[self::STREAMER_TYPE] == self::STREAMER_TYPE_HEX) {
318 301
 						$encoder->content(strtoupper(bin2hex($this->{$map[self::STREAMER_VAR]})));
319
-					}
320
-					elseif (isset($map[self::STREAMER_TYPE]) && $map[self::STREAMER_TYPE] == self::STREAMER_TYPE_STREAM_ASPLAIN) {
302
+					} elseif (isset($map[self::STREAMER_TYPE]) && $map[self::STREAMER_TYPE] == self::STREAMER_TYPE_STREAM_ASPLAIN) {
321 303
 						$encoder->contentStream($this->{$map[self::STREAMER_VAR]}, false);
322
-					}
323
-					elseif (isset($map[self::STREAMER_TYPE]) && ($map[self::STREAMER_TYPE] == self::STREAMER_TYPE_STREAM_ASBASE64 || $map[self::STREAMER_TYPE] == self::STREAMER_TYPE_STREAM)) {
304
+					} elseif (isset($map[self::STREAMER_TYPE]) && ($map[self::STREAMER_TYPE] == self::STREAMER_TYPE_STREAM_ASBASE64 || $map[self::STREAMER_TYPE] == self::STREAMER_TYPE_STREAM)) {
324 305
 						$encoder->contentStream($this->{$map[self::STREAMER_VAR]}, true);
325 306
 					}
326 307
 					// implode comma or semicolon arrays into a string
@@ -328,8 +309,7 @@  discard block
 block discarded – undo
328 309
 						($map[self::STREAMER_TYPE] == self::STREAMER_TYPE_COMMA_SEPARATED || $map[self::STREAMER_TYPE] == self::STREAMER_TYPE_SEMICOLON_SEPARATED)) {
329 310
 						$glue = ($map[self::STREAMER_TYPE] == self::STREAMER_TYPE_COMMA_SEPARATED) ? ", " : "; ";
330 311
 						$encoder->content(implode($glue, $this->{$map[self::STREAMER_VAR]}));
331
-					}
332
-					else {
312
+					} else {
333 313
 						$encoder->content($this->{$map[self::STREAMER_VAR]});
334 314
 					}
335 315
 					$encoder->endTag();
@@ -357,27 +337,22 @@  discard block
 block discarded – undo
357 337
 			if (isset($this->{$v[self::STREAMER_VAR]})) {
358 338
 				if (is_object($this->{$v[self::STREAMER_VAR]}) && method_exists($this->{$v[self::STREAMER_VAR]}, "StripData")) {
359 339
 					$this->{$v[self::STREAMER_VAR]}->StripData($flags);
360
-				}
361
-				elseif (isset($v[self::STREAMER_ARRAY]) && !empty($this->{$v[self::STREAMER_VAR]})) {
340
+				} elseif (isset($v[self::STREAMER_ARRAY]) && !empty($this->{$v[self::STREAMER_VAR]})) {
362 341
 					foreach ($this->{$v[self::STREAMER_VAR]} as $element) {
363 342
 						if (is_object($element) && method_exists($element, "StripData")) {
364 343
 							$element->StripData($flags);
365
-						}
366
-						elseif ($flags === Streamer::STRIP_PRIVATE_DATA && isset($v[self::STREAMER_PRIVATE])) {
344
+						} elseif ($flags === Streamer::STRIP_PRIVATE_DATA && isset($v[self::STREAMER_PRIVATE])) {
367 345
 							if ($v[self::STREAMER_PRIVATE] !== true) {
368 346
 								$this->{$v[self::STREAMER_VAR]} = $v[self::STREAMER_PRIVATE];
369
-							}
370
-							else {
347
+							} else {
371 348
 								unset($this->{$v[self::STREAMER_VAR]});
372 349
 							}
373 350
 						}
374 351
 					}
375
-				}
376
-				elseif ($flags === Streamer::STRIP_PRIVATE_DATA && isset($v[self::STREAMER_PRIVATE])) {
352
+				} elseif ($flags === Streamer::STRIP_PRIVATE_DATA && isset($v[self::STREAMER_PRIVATE])) {
377 353
 					if ($v[self::STREAMER_PRIVATE] !== true) {
378 354
 						$this->{$v[self::STREAMER_VAR]} = $v[self::STREAMER_PRIVATE];
379
-					}
380
-					else {
355
+					} else {
381 356
 						unset($this->{$v[self::STREAMER_VAR]});
382 357
 					}
383 358
 				}
@@ -436,8 +411,7 @@  discard block
 block discarded – undo
436 411
 				SLog::Write(LOGLEVEL_DEBUG, sprintf("Streamer->jsonDeserialize(): top class '%s'", $v->gsSyncStateClass));
437 412
 				$this->{$k} = new $v->gsSyncStateClass();
438 413
 				$this->{$k}->jsonDeserialize($v);
439
-			}
440
-			else {
414
+			} else {
441 415
 				$this->{$k} = $v;
442 416
 			}
443 417
 		}
Please login to merge, or discard this patch.
lib/core/slog.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 		try {
65 65
 			self::getLogger()->Log($loglevel, $message);
66
-		}
67
-		catch (\Exception $e) {
66
+		} catch (\Exception $e) {
68 67
 			// @TODO How should we handle logging error ?
69 68
 			// Ignore any error.
70 69
 		}
@@ -126,8 +125,7 @@  discard block
 block discarded – undo
126 125
 			// if there is an impersonated user it's used instead of the GET user
127 126
 			if (Request::GetImpersonatedUser()) {
128 127
 				$user = Request::GetImpersonatedUser();
129
-			}
130
-			else {
128
+			} else {
131 129
 				list($user) = Utils::SplitDomainUser(strtolower(Request::GetGETUser()));
132 130
 			}
133 131
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@
 block discarded – undo
212 212
 		$errstr = $error["message"];
213 213
 
214 214
 		// do NOT log PHP Notice, Warning, Deprecated or Strict as FATAL
215
-		if ($errno & ~(E_NOTICE | E_WARNING | E_DEPRECATED | E_STRICT)) {
215
+		if ($errno & ~(E_NOTICE|E_WARNING|E_DEPRECATED|E_STRICT)) {
216 216
 			SLog::Write(LOGLEVEL_FATAL, sprintf("Fatal error: %s:%d - %s (%s)", $errfile, $errline, $errstr, $errno));
217 217
 		}
218 218
 	}
Please login to merge, or discard this patch.
lib/wbxml/wbxmldecoder.php 2 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@  discard block
 block discarded – undo
33 33
 	public static function InWhile($name) {
34 34
 		if (!isset(self::$loopCounter[$name])) {
35 35
 			self::$loopCounter[$name] = 0;
36
-		}
37
-		else {
36
+		} else {
38 37
 			++self::$loopCounter[$name];
39 38
 		}
40 39
 
@@ -119,8 +118,7 @@  discard block
 block discarded – undo
119 118
 					}
120 119
 					if ($next[EN_TYPE] == EN_CONTENT) {
121 120
 						$element[EN_CONTENT] .= $next[EN_CONTENT];
122
-					}
123
-					else {
121
+					} else {
124 122
 						$this->ungetElement($next);
125 123
 
126 124
 						break;
@@ -293,8 +291,7 @@  discard block
 block discarded – undo
293 291
 				if ($el[EN_FLAGS] & EN_FLAGS_CONTENT) {
294 292
 					SLog::Write(LOGLEVEL_WBXML, "I " . $spaces . " <" . $el[EN_TAG] . ">");
295 293
 					array_push($this->logStack, $el[EN_TAG]);
296
-				}
297
-				else {
294
+				} else {
298 295
 					SLog::Write(LOGLEVEL_WBXML, "I " . $spaces . " <" . $el[EN_TAG] . "/>");
299 296
 				}
300 297
 				break;
@@ -311,8 +308,7 @@  discard block
 block discarded – undo
311 308
 				$messagesize = strlen($el[EN_CONTENT]);
312 309
 				if ($messagesize > 10240 && !defined('WBXML_DEBUGGING')) {
313 310
 					$content = substr($el[EN_CONTENT], 0, 10240) . sprintf(" <log message with %d bytes truncated>", $messagesize);
314
-				}
315
-				else {
311
+				} else {
316 312
 					$content = $el[EN_CONTENT];
317 313
 				}
318 314
 				// Log but make sure it's not truncated again (will be slightly bigger than 10KB)
@@ -467,8 +463,7 @@  discard block
 block discarded – undo
467 463
 
468 464
 			if ($byte & 0x80) {
469 465
 				$uint = $uint << 7;
470
-			}
471
-			else {
466
+			} else {
472 467
 				break;
473 468
 			}
474 469
 		}
Please login to merge, or discard this patch.
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@
 block discarded – undo
34 34
 		if (!isset(self::$loopCounter[$name])) {
35 35
 			self::$loopCounter[$name] = 0;
36 36
 		}
37
-		else {
38
-			++self::$loopCounter[$name];
37
+		else {++self::$loopCounter[$name];
39 38
 		}
40 39
 
41 40
 		if (self::$loopCounter[$name] > self::MAXLOOP) {
Please login to merge, or discard this patch.