Passed
Push — master ( 7a1b45...fbf25e )
by Christoph
13:21 queued 10s
created
apps/dav/lib/DAV/GroupPrincipalBackend.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @return array
105 105
 	 */
106 106
 	public function getPrincipalByPath($path) {
107
-		$elements = explode('/', $path,  3);
107
+		$elements = explode('/', $path, 3);
108 108
 		if ($elements[0] !== 'principals') {
109 109
 			return null;
110 110
 		}
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 			return [];
144 144
 		}
145 145
 
146
-		return array_map(function ($user) {
146
+		return array_map(function($user) {
147 147
 			return $this->userToPrincipal($user);
148 148
 		}, $group->getUsers());
149 149
 	}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 				case '{DAV:}displayname':
224 224
 					$groups = $this->groupManager->search($value, $searchLimit);
225 225
 
226
-					$results[] = array_reduce($groups, function (array $carry, IGroup $group) use ($restrictGroups) {
226
+					$results[] = array_reduce($groups, function(array $carry, IGroup $group) use ($restrictGroups) {
227 227
 						$gid = $group->getGID();
228 228
 						// is sharing restricted to groups only?
229 229
 						if ($restrictGroups !== false) {
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 							}
233 233
 						}
234 234
 
235
-						$carry[] = self::PRINCIPAL_PREFIX . '/' . urlencode($gid);
235
+						$carry[] = self::PRINCIPAL_PREFIX.'/'.urlencode($gid);
236 236
 						return $carry;
237 237
 					}, []);
238 238
 					break;
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		$displayName = $group->getDisplayName();
313 313
 
314 314
 		return [
315
-			'uri' => 'principals/groups/' . urlencode($groupId),
315
+			'uri' => 'principals/groups/'.urlencode($groupId),
316 316
 			'{DAV:}displayname' => $displayName,
317 317
 			'{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'GROUP',
318 318
 		];
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		$displayName = $user->getDisplayName();
329 329
 
330 330
 		$principal = [
331
-			'uri' => 'principals/users/' . $userId,
331
+			'uri' => 'principals/users/'.$userId,
332 332
 			'{DAV:}displayname' => $displayName,
333 333
 			'{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL',
334 334
 		];
Please login to merge, or discard this patch.
apps/dav/lib/CardDAV/CardDavBackend.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 				'uri' => $row['uri'],
178 178
 				'principaluri' => $this->convertPrincipal($row['principaluri'], false),
179 179
 				'{DAV:}displayname' => $row['displayname'],
180
-				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
180
+				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
181 181
 				'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
182 182
 				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
183 183
 			];
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
 			->setParameter('principaluri', $principals, IQueryBuilder::PARAM_STR_ARRAY)
203 203
 			->execute();
204 204
 
205
-		$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
205
+		$readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only';
206 206
 		while ($row = $result->fetch()) {
207 207
 			if ($row['principaluri'] === $principalUri) {
208 208
 				continue;
209 209
 			}
210 210
 
211
-			$readOnly = (int)$row['access'] === Backend::ACCESS_READ;
211
+			$readOnly = (int) $row['access'] === Backend::ACCESS_READ;
212 212
 			if (isset($addressBooks[$row['id']])) {
213 213
 				if ($readOnly) {
214 214
 					// New share can not have more permissions then the old one.
@@ -222,18 +222,18 @@  discard block
 block discarded – undo
222 222
 			}
223 223
 
224 224
 			list(, $name) = \Sabre\Uri\split($row['principaluri']);
225
-			$uri = $row['uri'] . '_shared_by_' . $name;
226
-			$displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
225
+			$uri = $row['uri'].'_shared_by_'.$name;
226
+			$displayName = $row['displayname'].' ('.$this->getUserDisplayName($name).')';
227 227
 
228 228
 			$addressBooks[$row['id']] = [
229 229
 				'id' => $row['id'],
230 230
 				'uri' => $uri,
231 231
 				'principaluri' => $principalUriOriginal,
232 232
 				'{DAV:}displayname' => $displayName,
233
-				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
233
+				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
234 234
 				'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
235 235
 				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
236
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'],
236
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'],
237 237
 				$readOnlyPropertyName => $readOnly,
238 238
 			];
239 239
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 				'uri' => $row['uri'],
261 261
 				'principaluri' => $this->convertPrincipal($row['principaluri'], false),
262 262
 				'{DAV:}displayname' => $row['displayname'],
263
-				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
263
+				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
264 264
 				'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
265 265
 				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
266 266
 			];
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 			'uri' => $row['uri'],
308 308
 			'principaluri' => $row['principaluri'],
309 309
 			'{DAV:}displayname' => $row['displayname'],
310
-			'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
310
+			'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
311 311
 			'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
312 312
 			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
313 313
 		];
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 			'uri' => $row['uri'],
342 342
 			'principaluri' => $row['principaluri'],
343 343
 			'{DAV:}displayname' => $row['displayname'],
344
-			'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
344
+			'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
345 345
 			'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
346 346
 			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
347 347
 		];
@@ -370,17 +370,17 @@  discard block
 block discarded – undo
370 370
 	public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) {
371 371
 		$supportedProperties = [
372 372
 			'{DAV:}displayname',
373
-			'{' . Plugin::NS_CARDDAV . '}addressbook-description',
373
+			'{'.Plugin::NS_CARDDAV.'}addressbook-description',
374 374
 		];
375 375
 
376
-		$propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) {
376
+		$propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) {
377 377
 			$updates = [];
378 378
 			foreach ($mutations as $property => $newValue) {
379 379
 				switch ($property) {
380 380
 					case '{DAV:}displayname':
381 381
 						$updates['displayname'] = $newValue;
382 382
 						break;
383
-					case '{' . Plugin::NS_CARDDAV . '}addressbook-description':
383
+					case '{'.Plugin::NS_CARDDAV.'}addressbook-description':
384 384
 						$updates['description'] = $newValue;
385 385
 						break;
386 386
 				}
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 
397 397
 			$this->addChange($addressBookId, "", 2);
398 398
 
399
-			$addressBookRow = $this->getAddressBookById((int)$addressBookId);
399
+			$addressBookRow = $this->getAddressBookById((int) $addressBookId);
400 400
 			$shares = $this->getShares($addressBookId);
401
-			$this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int)$addressBookId, $addressBookRow, $shares, $mutations));
401
+			$this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int) $addressBookId, $addressBookRow, $shares, $mutations));
402 402
 
403 403
 			return true;
404 404
 		});
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
 				case '{DAV:}displayname':
428 428
 					$values['displayname'] = $newValue;
429 429
 					break;
430
-				case '{' . Plugin::NS_CARDDAV . '}addressbook-description':
430
+				case '{'.Plugin::NS_CARDDAV.'}addressbook-description':
431 431
 					$values['description'] = $newValue;
432 432
 					break;
433 433
 				default:
434
-					throw new BadRequest('Unknown property: ' . $property);
434
+					throw new BadRequest('Unknown property: '.$property);
435 435
 			}
436 436
 		}
437 437
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 
456 456
 		$addressBookId = $query->getLastInsertId();
457 457
 		$addressBookRow = $this->getAddressBookById($addressBookId);
458
-		$this->dispatcher->dispatchTyped(new AddressBookCreatedEvent((int)$addressBookId, $addressBookRow));
458
+		$this->dispatcher->dispatchTyped(new AddressBookCreatedEvent((int) $addressBookId, $addressBookRow));
459 459
 
460 460
 		return $addressBookId;
461 461
 	}
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 
527 527
 		$result = $query->execute();
528 528
 		while ($row = $result->fetch()) {
529
-			$row['etag'] = '"' . $row['etag'] . '"';
529
+			$row['etag'] = '"'.$row['etag'].'"';
530 530
 
531 531
 			$modified = false;
532 532
 			$row['carddata'] = $this->readBlob($row['carddata'], $modified);
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 		if (!$row) {
567 567
 			return false;
568 568
 		}
569
-		$row['etag'] = '"' . $row['etag'] . '"';
569
+		$row['etag'] = '"'.$row['etag'].'"';
570 570
 
571 571
 		$modified = false;
572 572
 		$row['carddata'] = $this->readBlob($row['carddata'], $modified);
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 			$result = $query->execute();
609 609
 
610 610
 			while ($row = $result->fetch()) {
611
-				$row['etag'] = '"' . $row['etag'] . '"';
611
+				$row['etag'] = '"'.$row['etag'].'"';
612 612
 
613 613
 				$modified = false;
614 614
 				$row['carddata'] = $this->readBlob($row['carddata'], $modified);
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 			->andWhere($q->expr()->eq('uid', $q->createNamedParameter($uid)))
660 660
 			->setMaxResults(1);
661 661
 		$result = $q->execute();
662
-		$count = (bool)$result->fetchColumn();
662
+		$count = (bool) $result->fetchColumn();
663 663
 		$result->closeCursor();
664 664
 		if ($count) {
665 665
 			throw new \Sabre\DAV\Exception\BadRequest('VCard object with uid already exists in this addressbook collection.');
@@ -687,14 +687,14 @@  discard block
 block discarded – undo
687 687
 		$addressBookData = $this->getAddressBookById($addressBookId);
688 688
 		$shares = $this->getShares($addressBookId);
689 689
 		$objectRow = $this->getCard($addressBookId, $cardUri);
690
-		$this->dispatcher->dispatchTyped(new CardCreatedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow));
690
+		$this->dispatcher->dispatchTyped(new CardCreatedEvent((int) $addressBookId, $addressBookData, $shares, $objectRow));
691 691
 		$this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::createCard',
692 692
 			new GenericEvent(null, [
693 693
 				'addressBookId' => $addressBookId,
694 694
 				'cardUri' => $cardUri,
695 695
 				'cardData' => $cardData]));
696 696
 
697
-		return '"' . $etag . '"';
697
+		return '"'.$etag.'"';
698 698
 	}
699 699
 
700 700
 	/**
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 		// check for recently stored etag and stop if it is the same
731 731
 		$etagCacheKey = "$addressBookId#$cardUri";
732 732
 		if (isset($this->etagCache[$etagCacheKey]) && $this->etagCache[$etagCacheKey] === $etag) {
733
-			return '"' . $etag . '"';
733
+			return '"'.$etag.'"';
734 734
 		}
735 735
 
736 736
 		$query->update($this->dbCardsTable)
@@ -751,14 +751,14 @@  discard block
 block discarded – undo
751 751
 		$addressBookData = $this->getAddressBookById($addressBookId);
752 752
 		$shares = $this->getShares($addressBookId);
753 753
 		$objectRow = $this->getCard($addressBookId, $cardUri);
754
-		$this->dispatcher->dispatchTyped(new CardUpdatedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow));
754
+		$this->dispatcher->dispatchTyped(new CardUpdatedEvent((int) $addressBookId, $addressBookData, $shares, $objectRow));
755 755
 		$this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::updateCard',
756 756
 			new GenericEvent(null, [
757 757
 				'addressBookId' => $addressBookId,
758 758
 				'cardUri' => $cardUri,
759 759
 				'cardData' => $cardData]));
760 760
 
761
-		return '"' . $etag . '"';
761
+		return '"'.$etag.'"';
762 762
 	}
763 763
 
764 764
 	/**
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 
789 789
 		if ($ret === 1) {
790 790
 			if ($cardId !== null) {
791
-				$this->dispatcher->dispatchTyped(new CardDeletedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow));
791
+				$this->dispatcher->dispatchTyped(new CardDeletedEvent((int) $addressBookId, $addressBookData, $shares, $objectRow));
792 792
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::deleteCard',
793 793
 					new GenericEvent(null, [
794 794
 						'addressBookId' => $addressBookId,
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 		if ($syncToken) {
879 879
 			$query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`";
880 880
 			if ($limit > 0) {
881
-				$query .= " LIMIT " . (int)$limit;
881
+				$query .= " LIMIT ".(int) $limit;
882 882
 			}
883 883
 
884 884
 			// Fetching all changes
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 									   string $pattern,
1022 1022
 									   array $searchProperties,
1023 1023
 									   array $options = []): array {
1024
-		$addressBookIds = array_map(static function ($row):int {
1024
+		$addressBookIds = array_map(static function($row):int {
1025 1025
 			return (int) $row['id'];
1026 1026
 		}, $this->getAddressBooksForUser($principalUri));
1027 1027
 
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
 			if (!$escapePattern) {
1085 1085
 				$query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter($pattern)));
1086 1086
 			} else {
1087
-				$query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
1087
+				$query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%')));
1088 1088
 			}
1089 1089
 		}
1090 1090
 
@@ -1098,8 +1098,8 @@  discard block
 block discarded – undo
1098 1098
 		$result = $query2->execute();
1099 1099
 		$matches = $result->fetchAll();
1100 1100
 		$result->closeCursor();
1101
-		$matches = array_map(function ($match) {
1102
-			return (int)$match['cardid'];
1101
+		$matches = array_map(function($match) {
1102
+			return (int) $match['cardid'];
1103 1103
 		}, $matches);
1104 1104
 
1105 1105
 		$query = $this->db->getQueryBuilder();
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 
1113 1113
 		$result->closeCursor();
1114 1114
 
1115
-		return array_map(function ($array) {
1115
+		return array_map(function($array) {
1116 1116
 			$array['addressbookid'] = (int) $array['addressbookid'];
1117 1117
 			$modified = false;
1118 1118
 			$array['carddata'] = $this->readBlob($array['carddata'], $modified);
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 		$result->closeCursor();
1160 1160
 
1161 1161
 		if (!isset($uri['uri'])) {
1162
-			throw new \InvalidArgumentException('Card does not exists: ' . $id);
1162
+			throw new \InvalidArgumentException('Card does not exists: '.$id);
1163 1163
 		}
1164 1164
 
1165 1165
 		return $uri['uri'];
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 
1185 1185
 		if (is_array($contact)) {
1186 1186
 			$modified = false;
1187
-			$contact['etag'] = '"' . $contact['etag'] . '"';
1187
+			$contact['etag'] = '"'.$contact['etag'].'"';
1188 1188
 			$contact['carddata'] = $this->readBlob($contact['carddata'], $modified);
1189 1189
 			if ($modified) {
1190 1190
 				$contact['size'] = strlen($contact['carddata']);
@@ -1297,10 +1297,10 @@  discard block
 block discarded – undo
1297 1297
 		$result->closeCursor();
1298 1298
 
1299 1299
 		if (!isset($cardIds['id'])) {
1300
-			throw new \InvalidArgumentException('Card does not exists: ' . $uri);
1300
+			throw new \InvalidArgumentException('Card does not exists: '.$uri);
1301 1301
 		}
1302 1302
 
1303
-		return (int)$cardIds['id'];
1303
+		return (int) $cardIds['id'];
1304 1304
 	}
1305 1305
 
1306 1306
 	/**
@@ -1326,8 +1326,8 @@  discard block
 block discarded – undo
1326 1326
 	}
1327 1327
 
1328 1328
 	private function addOwnerPrincipal(&$addressbookInfo) {
1329
-		$ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
1330
-		$displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
1329
+		$ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal';
1330
+		$displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname';
1331 1331
 		if (isset($addressbookInfo[$ownerPrincipalKey])) {
1332 1332
 			$uri = $addressbookInfo[$ownerPrincipalKey];
1333 1333
 		} else {
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/CalDavBackend.php 1 patch
Spacing   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		}
256 256
 
257 257
 		$result = $query->execute();
258
-		$column = (int)$result->fetchColumn();
258
+		$column = (int) $result->fetchColumn();
259 259
 		$result->closeCursor();
260 260
 		return $column;
261 261
 	}
@@ -315,18 +315,18 @@  discard block
 block discarded – undo
315 315
 			$row['principaluri'] = (string) $row['principaluri'];
316 316
 			$components = [];
317 317
 			if ($row['components']) {
318
-				$components = explode(',',$row['components']);
318
+				$components = explode(',', $row['components']);
319 319
 			}
320 320
 
321 321
 			$calendar = [
322 322
 				'id' => $row['id'],
323 323
 				'uri' => $row['uri'],
324 324
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
325
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
326
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
327
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
328
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
329
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
325
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
326
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
327
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
328
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
329
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
330 330
 			];
331 331
 
332 332
 			foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
 			->setParameter('type', 'calendar')
365 365
 			->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY);
366 366
 
367
-		$result	= $query->execute();
367
+		$result = $query->execute();
368 368
 
369
-		$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
369
+		$readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only';
370 370
 		while ($row = $result->fetch()) {
371 371
 			$row['principaluri'] = (string) $row['principaluri'];
372 372
 			if ($row['principaluri'] === $principalUri) {
@@ -387,21 +387,21 @@  discard block
 block discarded – undo
387 387
 			}
388 388
 
389 389
 			list(, $name) = Uri\split($row['principaluri']);
390
-			$uri = $row['uri'] . '_shared_by_' . $name;
391
-			$row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
390
+			$uri = $row['uri'].'_shared_by_'.$name;
391
+			$row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')';
392 392
 			$components = [];
393 393
 			if ($row['components']) {
394
-				$components = explode(',',$row['components']);
394
+				$components = explode(',', $row['components']);
395 395
 			}
396 396
 			$calendar = [
397 397
 				'id' => $row['id'],
398 398
 				'uri' => $uri,
399 399
 				'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
400
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
401
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
402
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
403
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
404
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
400
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
401
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
402
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
403
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
404
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
405 405
 				$readOnlyPropertyName => $readOnly,
406 406
 			];
407 407
 
@@ -442,16 +442,16 @@  discard block
 block discarded – undo
442 442
 			$row['principaluri'] = (string) $row['principaluri'];
443 443
 			$components = [];
444 444
 			if ($row['components']) {
445
-				$components = explode(',',$row['components']);
445
+				$components = explode(',', $row['components']);
446 446
 			}
447 447
 			$calendar = [
448 448
 				'id' => $row['id'],
449 449
 				'uri' => $row['uri'],
450 450
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
451
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
452
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
453
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
454
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
451
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
452
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
453
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
454
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
455 455
 			];
456 456
 			foreach ($this->propertyMap as $xmlName => $dbName) {
457 457
 				$calendar[$xmlName] = $row[$dbName];
@@ -511,22 +511,22 @@  discard block
 block discarded – undo
511 511
 		while ($row = $result->fetch()) {
512 512
 			$row['principaluri'] = (string) $row['principaluri'];
513 513
 			list(, $name) = Uri\split($row['principaluri']);
514
-			$row['displayname'] = $row['displayname'] . "($name)";
514
+			$row['displayname'] = $row['displayname']."($name)";
515 515
 			$components = [];
516 516
 			if ($row['components']) {
517
-				$components = explode(',',$row['components']);
517
+				$components = explode(',', $row['components']);
518 518
 			}
519 519
 			$calendar = [
520 520
 				'id' => $row['id'],
521 521
 				'uri' => $row['publicuri'],
522 522
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
523
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
524
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
525
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
526
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
527
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
528
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
529
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
523
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
524
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
525
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
526
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
527
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
528
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
529
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
530 530
 			];
531 531
 
532 532
 			foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -573,27 +573,27 @@  discard block
 block discarded – undo
573 573
 		$result->closeCursor();
574 574
 
575 575
 		if ($row === false) {
576
-			throw new NotFound('Node with name \'' . $uri . '\' could not be found');
576
+			throw new NotFound('Node with name \''.$uri.'\' could not be found');
577 577
 		}
578 578
 
579 579
 		$row['principaluri'] = (string) $row['principaluri'];
580 580
 		list(, $name) = Uri\split($row['principaluri']);
581
-		$row['displayname'] = $row['displayname'] . ' ' . "($name)";
581
+		$row['displayname'] = $row['displayname'].' '."($name)";
582 582
 		$components = [];
583 583
 		if ($row['components']) {
584
-			$components = explode(',',$row['components']);
584
+			$components = explode(',', $row['components']);
585 585
 		}
586 586
 		$calendar = [
587 587
 			'id' => $row['id'],
588 588
 			'uri' => $row['publicuri'],
589 589
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
590
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
591
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
592
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
593
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
594
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
595
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
596
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
590
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
591
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
592
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
593
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
594
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
595
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
596
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
597 597
 		];
598 598
 
599 599
 		foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -636,17 +636,17 @@  discard block
 block discarded – undo
636 636
 		$row['principaluri'] = (string) $row['principaluri'];
637 637
 		$components = [];
638 638
 		if ($row['components']) {
639
-			$components = explode(',',$row['components']);
639
+			$components = explode(',', $row['components']);
640 640
 		}
641 641
 
642 642
 		$calendar = [
643 643
 			'id' => $row['id'],
644 644
 			'uri' => $row['uri'],
645 645
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
646
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
647
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
648
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
649
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
646
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
647
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
648
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
649
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
650 650
 		];
651 651
 
652 652
 		foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -687,17 +687,17 @@  discard block
 block discarded – undo
687 687
 		$row['principaluri'] = (string) $row['principaluri'];
688 688
 		$components = [];
689 689
 		if ($row['components']) {
690
-			$components = explode(',',$row['components']);
690
+			$components = explode(',', $row['components']);
691 691
 		}
692 692
 
693 693
 		$calendar = [
694 694
 			'id' => $row['id'],
695 695
 			'uri' => $row['uri'],
696 696
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
697
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
698
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
699
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
700
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
697
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
698
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
699
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
700
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
701 701
 		];
702 702
 
703 703
 		foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -741,8 +741,8 @@  discard block
 block discarded – undo
741 741
 			'principaluri' => $row['principaluri'],
742 742
 			'source' => $row['source'],
743 743
 			'lastmodified' => $row['lastmodified'],
744
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
745
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
744
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
745
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
746 746
 		];
747 747
 
748 748
 		foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
@@ -779,16 +779,16 @@  discard block
 block discarded – undo
779 779
 		$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
780 780
 		if (isset($properties[$sccs])) {
781 781
 			if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) {
782
-				throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
782
+				throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
783 783
 			}
784
-			$values['components'] = implode(',',$properties[$sccs]->getValue());
784
+			$values['components'] = implode(',', $properties[$sccs]->getValue());
785 785
 		} elseif (isset($properties['components'])) {
786 786
 			// Allow to provide components internally without having
787 787
 			// to create a SupportedCalendarComponentSet object
788 788
 			$values['components'] = $properties['components'];
789 789
 		}
790 790
 
791
-		$transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
791
+		$transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
792 792
 		if (isset($properties[$transp])) {
793 793
 			$values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent');
794 794
 		}
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 		$calendarId = $query->getLastInsertId();
809 809
 
810 810
 		$calendarData = $this->getCalendarById($calendarId);
811
-		$this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData));
811
+		$this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData));
812 812
 		$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent(
813 813
 			'\OCA\DAV\CalDAV\CalDavBackend::createCalendar',
814 814
 			[
@@ -837,13 +837,13 @@  discard block
 block discarded – undo
837 837
 	 */
838 838
 	public function updateCalendar($calendarId, PropPatch $propPatch) {
839 839
 		$supportedProperties = array_keys($this->propertyMap);
840
-		$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
840
+		$supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
841 841
 
842
-		$propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) {
842
+		$propPatch->handle($supportedProperties, function($mutations) use ($calendarId) {
843 843
 			$newValues = [];
844 844
 			foreach ($mutations as $propertyName => $propertyValue) {
845 845
 				switch ($propertyName) {
846
-					case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp':
846
+					case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp':
847 847
 						$fieldName = 'transparent';
848 848
 						$newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent');
849 849
 						break;
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 
866 866
 			$calendarData = $this->getCalendarById($calendarId);
867 867
 			$shares = $this->getShares($calendarId);
868
-			$this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations));
868
+			$this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int) $calendarId, $calendarData, $shares, $mutations));
869 869
 			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent(
870 870
 				'\OCA\DAV\CalDAV\CalDavBackend::updateCalendar',
871 871
 				[
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 			->execute();
916 916
 
917 917
 		if ($calendarData) {
918
-			$this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares));
918
+			$this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int) $calendarId, $calendarData, $shares));
919 919
 		}
920 920
 	}
921 921
 
@@ -975,11 +975,11 @@  discard block
 block discarded – undo
975 975
 				'id' => $row['id'],
976 976
 				'uri' => $row['uri'],
977 977
 				'lastmodified' => $row['lastmodified'],
978
-				'etag' => '"' . $row['etag'] . '"',
978
+				'etag' => '"'.$row['etag'].'"',
979 979
 				'calendarid' => $row['calendarid'],
980
-				'size' => (int)$row['size'],
980
+				'size' => (int) $row['size'],
981 981
 				'component' => strtolower($row['componenttype']),
982
-				'classification' => (int)$row['classification']
982
+				'classification' => (int) $row['classification']
983 983
 			];
984 984
 		}
985 985
 		$stmt->closeCursor();
@@ -1023,12 +1023,12 @@  discard block
 block discarded – undo
1023 1023
 			'id' => $row['id'],
1024 1024
 			'uri' => $row['uri'],
1025 1025
 			'lastmodified' => $row['lastmodified'],
1026
-			'etag' => '"' . $row['etag'] . '"',
1026
+			'etag' => '"'.$row['etag'].'"',
1027 1027
 			'calendarid' => $row['calendarid'],
1028
-			'size' => (int)$row['size'],
1028
+			'size' => (int) $row['size'],
1029 1029
 			'calendardata' => $this->readBlob($row['calendardata']),
1030 1030
 			'component' => strtolower($row['componenttype']),
1031
-			'classification' => (int)$row['classification']
1031
+			'classification' => (int) $row['classification']
1032 1032
 		];
1033 1033
 	}
1034 1034
 
@@ -1069,12 +1069,12 @@  discard block
 block discarded – undo
1069 1069
 					'id' => $row['id'],
1070 1070
 					'uri' => $row['uri'],
1071 1071
 					'lastmodified' => $row['lastmodified'],
1072
-					'etag' => '"' . $row['etag'] . '"',
1072
+					'etag' => '"'.$row['etag'].'"',
1073 1073
 					'calendarid' => $row['calendarid'],
1074
-					'size' => (int)$row['size'],
1074
+					'size' => (int) $row['size'],
1075 1075
 					'calendardata' => $this->readBlob($row['calendardata']),
1076 1076
 					'component' => strtolower($row['componenttype']),
1077
-					'classification' => (int)$row['classification']
1077
+					'classification' => (int) $row['classification']
1078 1078
 				];
1079 1079
 			}
1080 1080
 			$result->closeCursor();
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 			$calendarRow = $this->getCalendarById($calendarId);
1147 1147
 			$shares = $this->getShares($calendarId);
1148 1148
 
1149
-			$this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow));
1149
+			$this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow));
1150 1150
 			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent(
1151 1151
 				'\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject',
1152 1152
 				[
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 		} else {
1160 1160
 			$subscriptionRow = $this->getSubscriptionById($calendarId);
1161 1161
 
1162
-			$this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow));
1162
+			$this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow));
1163 1163
 			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent(
1164 1164
 				'\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject',
1165 1165
 				[
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 			));
1172 1172
 		}
1173 1173
 
1174
-		return '"' . $extraData['etag'] . '"';
1174
+		return '"'.$extraData['etag'].'"';
1175 1175
 	}
1176 1176
 
1177 1177
 	/**
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
 				$calendarRow = $this->getCalendarById($calendarId);
1221 1221
 				$shares = $this->getShares($calendarId);
1222 1222
 
1223
-				$this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow));
1223
+				$this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow));
1224 1224
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent(
1225 1225
 					'\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject',
1226 1226
 					[
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 			} else {
1234 1234
 				$subscriptionRow = $this->getSubscriptionById($calendarId);
1235 1235
 
1236
-				$this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow));
1236
+				$this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow));
1237 1237
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent(
1238 1238
 					'\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject',
1239 1239
 					[
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
 			}
1247 1247
 		}
1248 1248
 
1249
-		return '"' . $extraData['etag'] . '"';
1249
+		return '"'.$extraData['etag'].'"';
1250 1250
 	}
1251 1251
 
1252 1252
 	/**
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
 				$calendarRow = $this->getCalendarById($calendarId);
1284 1284
 				$shares = $this->getShares($calendarId);
1285 1285
 
1286
-				$this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data));
1286
+				$this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int) $calendarId, $calendarRow, $shares, $data));
1287 1287
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent(
1288 1288
 					'\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject',
1289 1289
 					[
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
 			} else {
1297 1297
 				$subscriptionRow = $this->getSubscriptionById($calendarId);
1298 1298
 
1299
-				$this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int)$calendarId, $subscriptionRow, [], $data));
1299
+				$this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int) $calendarId, $subscriptionRow, [], $data));
1300 1300
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent(
1301 1301
 					'\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject',
1302 1302
 					[
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
 
1569 1569
 		$result = [];
1570 1570
 		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1571
-			$path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
1571
+			$path = $uriMapper[$row['calendarid']].'/'.$row['uri'];
1572 1572
 			if (!in_array($path, $result)) {
1573 1573
 				$result[] = $path;
1574 1574
 			}
@@ -1616,8 +1616,8 @@  discard block
 block discarded – undo
1616 1616
 
1617 1617
 		if ($pattern !== '') {
1618 1618
 			$innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
1619
-				$outerQuery->createNamedParameter('%' .
1620
-					$this->db->escapeLikeParameter($pattern) . '%')));
1619
+				$outerQuery->createNamedParameter('%'.
1620
+					$this->db->escapeLikeParameter($pattern).'%')));
1621 1621
 		}
1622 1622
 
1623 1623
 		$outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 		$result = $outerQuery->execute();
1657 1657
 		$calendarObjects = $result->fetchAll();
1658 1658
 
1659
-		return array_map(function ($o) {
1659
+		return array_map(function($o) {
1660 1660
 			$calendarData = Reader::read($o['calendardata']);
1661 1661
 			$comps = $calendarData->getComponents();
1662 1662
 			$objects = [];
@@ -1674,10 +1674,10 @@  discard block
 block discarded – undo
1674 1674
 				'type' => $o['componenttype'],
1675 1675
 				'uid' => $o['uid'],
1676 1676
 				'uri' => $o['uri'],
1677
-				'objects' => array_map(function ($c) {
1677
+				'objects' => array_map(function($c) {
1678 1678
 					return $this->transformSearchData($c);
1679 1679
 				}, $objects),
1680
-				'timezones' => array_map(function ($c) {
1680
+				'timezones' => array_map(function($c) {
1681 1681
 					return $this->transformSearchData($c);
1682 1682
 				}, $timezones),
1683 1683
 			];
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
 		/** @var Component[] $subComponents */
1694 1694
 		$subComponents = $comp->getComponents();
1695 1695
 		/** @var Property[] $properties */
1696
-		$properties = array_filter($comp->children(), function ($c) {
1696
+		$properties = array_filter($comp->children(), function($c) {
1697 1697
 			return $c instanceof Property;
1698 1698
 		});
1699 1699
 		$validationRules = $comp->getValidationRules();
@@ -1771,7 +1771,7 @@  discard block
 block discarded – undo
1771 1771
 		$subscriptions = $this->getSubscriptionsForUser($principalUri);
1772 1772
 		foreach ($calendars as $calendar) {
1773 1773
 			$calendarAnd = $calendarObjectIdQuery->expr()->andX();
1774
-			$calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])));
1774
+			$calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id'])));
1775 1775
 			$calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1776 1776
 
1777 1777
 			// If it's shared, limit search to public events
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
 		}
1784 1784
 		foreach ($subscriptions as $subscription) {
1785 1785
 			$subscriptionAnd = $calendarObjectIdQuery->expr()->andX();
1786
-			$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])));
1786
+			$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id'])));
1787 1787
 			$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)));
1788 1788
 
1789 1789
 			// If it's shared, limit search to public events
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
 			if (!$escapePattern) {
1828 1828
 				$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern)));
1829 1829
 			} else {
1830
-				$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
1830
+				$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%')));
1831 1831
 			}
1832 1832
 		}
1833 1833
 
@@ -1841,7 +1841,7 @@  discard block
 block discarded – undo
1841 1841
 		$result = $calendarObjectIdQuery->execute();
1842 1842
 		$matches = $result->fetchAll();
1843 1843
 		$result->closeCursor();
1844
-		$matches = array_map(static function (array $match):int {
1844
+		$matches = array_map(static function(array $match):int {
1845 1845
 			return (int) $match['objectid'];
1846 1846
 		}, $matches);
1847 1847
 
@@ -1854,9 +1854,9 @@  discard block
 block discarded – undo
1854 1854
 		$calendarObjects = $result->fetchAll();
1855 1855
 		$result->closeCursor();
1856 1856
 
1857
-		return array_map(function (array $array): array {
1858
-			$array['calendarid'] = (int)$array['calendarid'];
1859
-			$array['calendartype'] = (int)$array['calendartype'];
1857
+		return array_map(function(array $array): array {
1858
+			$array['calendarid'] = (int) $array['calendarid'];
1859
+			$array['calendartype'] = (int) $array['calendartype'];
1860 1860
 			$array['calendardata'] = $this->readBlob($array['calendardata']);
1861 1861
 
1862 1862
 			return $array;
@@ -1893,7 +1893,7 @@  discard block
 block discarded – undo
1893 1893
 		$stmt = $query->execute();
1894 1894
 
1895 1895
 		if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1896
-			return $row['calendaruri'] . '/' . $row['objecturi'];
1896
+			return $row['calendaruri'].'/'.$row['objecturi'];
1897 1897
 		}
1898 1898
 
1899 1899
 		return null;
@@ -1959,7 +1959,7 @@  discard block
 block discarded – undo
1959 1959
 	public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
1960 1960
 		// Current synctoken
1961 1961
 		$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
1962
-		$stmt->execute([ $calendarId ]);
1962
+		$stmt->execute([$calendarId]);
1963 1963
 		$currentToken = $stmt->fetchColumn(0);
1964 1964
 
1965 1965
 		if (is_null($currentToken)) {
@@ -1976,7 +1976,7 @@  discard block
 block discarded – undo
1976 1976
 		if ($syncToken) {
1977 1977
 			$query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? AND `calendartype` = ? ORDER BY `synctoken`";
1978 1978
 			if ($limit > 0) {
1979
-				$query .= " LIMIT " . (int)$limit;
1979
+				$query .= " LIMIT ".(int) $limit;
1980 1980
 			}
1981 1981
 
1982 1982
 			// Fetching all changes
@@ -2072,8 +2072,8 @@  discard block
 block discarded – undo
2072 2072
 				'source' => $row['source'],
2073 2073
 				'lastmodified' => $row['lastmodified'],
2074 2074
 
2075
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
2076
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
2075
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
2076
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
2077 2077
 			];
2078 2078
 
2079 2079
 			foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
@@ -2137,7 +2137,7 @@  discard block
 block discarded – undo
2137 2137
 		$subscriptionId = $this->db->lastInsertId('*PREFIX*calendarsubscriptions');
2138 2138
 
2139 2139
 		$subscriptionRow = $this->getSubscriptionById($subscriptionId);
2140
-		$this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent((int)$subscriptionId, $subscriptionRow));
2140
+		$this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent((int) $subscriptionId, $subscriptionRow));
2141 2141
 		$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', new GenericEvent(
2142 2142
 			'\OCA\DAV\CalDAV\CalDavBackend::createSubscription',
2143 2143
 			[
@@ -2168,7 +2168,7 @@  discard block
 block discarded – undo
2168 2168
 		$supportedProperties = array_keys($this->subscriptionPropertyMap);
2169 2169
 		$supportedProperties[] = '{http://calendarserver.org/ns/}source';
2170 2170
 
2171
-		$propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
2171
+		$propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) {
2172 2172
 			$newValues = [];
2173 2173
 
2174 2174
 			foreach ($mutations as $propertyName => $propertyValue) {
@@ -2190,7 +2190,7 @@  discard block
 block discarded – undo
2190 2190
 				->execute();
2191 2191
 
2192 2192
 			$subscriptionRow = $this->getSubscriptionById($subscriptionId);
2193
-			$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations));
2193
+			$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations));
2194 2194
 			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent(
2195 2195
 				'\OCA\DAV\CalDAV\CalDavBackend::updateSubscription',
2196 2196
 				[
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
 			->execute();
2242 2242
 
2243 2243
 		if ($subscriptionRow) {
2244
-			$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, []));
2244
+			$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, []));
2245 2245
 		}
2246 2246
 	}
2247 2247
 
@@ -2279,8 +2279,8 @@  discard block
 block discarded – undo
2279 2279
 			'uri' => $row['uri'],
2280 2280
 			'calendardata' => $row['calendardata'],
2281 2281
 			'lastmodified' => $row['lastmodified'],
2282
-			'etag' => '"' . $row['etag'] . '"',
2283
-			'size' => (int)$row['size'],
2282
+			'etag' => '"'.$row['etag'].'"',
2283
+			'size' => (int) $row['size'],
2284 2284
 		];
2285 2285
 	}
2286 2286
 
@@ -2308,8 +2308,8 @@  discard block
 block discarded – undo
2308 2308
 				'calendardata' => $row['calendardata'],
2309 2309
 				'uri' => $row['uri'],
2310 2310
 				'lastmodified' => $row['lastmodified'],
2311
-				'etag' => '"' . $row['etag'] . '"',
2312
-				'size' => (int)$row['size'],
2311
+				'etag' => '"'.$row['etag'].'"',
2312
+				'size' => (int) $row['size'],
2313 2313
 			];
2314 2314
 		}
2315 2315
 
@@ -2363,14 +2363,14 @@  discard block
 block discarded – undo
2363 2363
 	 * @return void
2364 2364
 	 */
2365 2365
 	protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2366
-		$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
2366
+		$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions';
2367 2367
 
2368 2368
 		$query = $this->db->getQueryBuilder();
2369 2369
 		$query->select('synctoken')
2370 2370
 			->from($table)
2371 2371
 			->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
2372 2372
 		$result = $query->execute();
2373
-		$syncToken = (int)$result->fetchColumn();
2373
+		$syncToken = (int) $result->fetchColumn();
2374 2374
 		$result->closeCursor();
2375 2375
 
2376 2376
 		$query = $this->db->getQueryBuilder();
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
 				// Track first component type and uid
2428 2428
 				if ($uid === null) {
2429 2429
 					$componentType = $component->name;
2430
-					$uid = (string)$component->UID;
2430
+					$uid = (string) $component->UID;
2431 2431
 				}
2432 2432
 			}
2433 2433
 		}
@@ -2526,7 +2526,7 @@  discard block
 block discarded – undo
2526 2526
 			]));
2527 2527
 		$this->calendarSharingBackend->updateShares($shareable, $add, $remove);
2528 2528
 
2529
-		$this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int)$calendarId, $calendarRow, $oldShares, $add, $remove));
2529
+		$this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int) $calendarId, $calendarRow, $oldShares, $add, $remove));
2530 2530
 	}
2531 2531
 
2532 2532
 	/**
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
 				]);
2568 2568
 			$query->execute();
2569 2569
 
2570
-			$this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri));
2570
+			$this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int) $calendarId, $calendarData, $publicUri));
2571 2571
 			return $publicUri;
2572 2572
 		}
2573 2573
 		$query->delete('dav_shares')
@@ -2575,7 +2575,7 @@  discard block
 block discarded – undo
2575 2575
 			->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)));
2576 2576
 		$query->execute();
2577 2577
 
2578
-		$this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData));
2578
+		$this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int) $calendarId, $calendarData));
2579 2579
 		return null;
2580 2580
 	}
2581 2581
 
@@ -2796,10 +2796,10 @@  discard block
 block discarded – undo
2796 2796
 		$result->closeCursor();
2797 2797
 
2798 2798
 		if (!isset($objectIds['id'])) {
2799
-			throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri);
2799
+			throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri);
2800 2800
 		}
2801 2801
 
2802
-		return (int)$objectIds['id'];
2802
+		return (int) $objectIds['id'];
2803 2803
 	}
2804 2804
 
2805 2805
 	/**
@@ -2826,8 +2826,8 @@  discard block
 block discarded – undo
2826 2826
 	 * @param $calendarInfo
2827 2827
 	 */
2828 2828
 	private function addOwnerPrincipal(&$calendarInfo) {
2829
-		$ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
2830
-		$displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
2829
+		$ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal';
2830
+		$displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname';
2831 2831
 		if (isset($calendarInfo[$ownerPrincipalKey])) {
2832 2832
 			$uri = $calendarInfo[$ownerPrincipalKey];
2833 2833
 		} else {
Please login to merge, or discard this patch.