Completed
Push — master ( d73537...38327e )
by
unknown
34:40 queued 12:15
created
apps/dav/lib/CardDAV/CardDavBackend.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
79 79
 
80 80
 		$result = $query->executeQuery();
81
-		$column = (int)$result->fetchOne();
81
+		$column = (int) $result->fetchOne();
82 82
 		$result->closeCursor();
83 83
 		return $column;
84 84
 	}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @return array
102 102
 	 */
103 103
 	public function getAddressBooksForUser($principalUri) {
104
-		return $this->atomic(function () use ($principalUri) {
104
+		return $this->atomic(function() use ($principalUri) {
105 105
 			$principalUriOriginal = $principalUri;
106 106
 			$principalUri = $this->convertPrincipal($principalUri, true);
107 107
 			$select = $this->db->getQueryBuilder();
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 					'uri' => $row['uri'],
119 119
 					'principaluri' => $this->convertPrincipal($row['principaluri'], false),
120 120
 					'{DAV:}displayname' => $row['displayname'],
121
-					'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
121
+					'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
122 122
 					'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
123 123
 					'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
124 124
 				];
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
 				->andWhere($select->expr()->notIn('s.id', $select->createFunction($subSelect->getSQL()), IQueryBuilder::PARAM_INT_ARRAY));
150 150
 			$result = $select->executeQuery();
151 151
 
152
-			$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
152
+			$readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only';
153 153
 			while ($row = $result->fetch()) {
154 154
 				if ($row['principaluri'] === $principalUri) {
155 155
 					continue;
156 156
 				}
157 157
 
158
-				$readOnly = (int)$row['access'] === Backend::ACCESS_READ;
158
+				$readOnly = (int) $row['access'] === Backend::ACCESS_READ;
159 159
 				if (isset($addressBooks[$row['id']])) {
160 160
 					if ($readOnly) {
161 161
 						// New share can not have more permissions then the old one.
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
 				}
170 170
 
171 171
 				[, $name] = \Sabre\Uri\split($row['principaluri']);
172
-				$uri = $row['uri'] . '_shared_by_' . $name;
173
-				$displayName = $row['displayname'] . ' (' . ($this->userManager->getDisplayName($name) ?? $name ?? '') . ')';
172
+				$uri = $row['uri'].'_shared_by_'.$name;
173
+				$displayName = $row['displayname'].' ('.($this->userManager->getDisplayName($name) ?? $name ?? '').')';
174 174
 
175 175
 				$addressBooks[$row['id']] = [
176 176
 					'id' => $row['id'],
177 177
 					'uri' => $uri,
178 178
 					'principaluri' => $principalUriOriginal,
179 179
 					'{DAV:}displayname' => $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
-					'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'],
183
+					'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'],
184 184
 					$readOnlyPropertyName => $readOnly,
185 185
 				];
186 186
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 				'uri' => $row['uri'],
209 209
 				'principaluri' => $this->convertPrincipal($row['principaluri'], false),
210 210
 				'{DAV:}displayname' => $row['displayname'],
211
-				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
211
+				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
212 212
 				'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
213 213
 				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
214 214
 			];
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			'uri' => $row['uri'],
241 241
 			'principaluri' => $row['principaluri'],
242 242
 			'{DAV:}displayname' => $row['displayname'],
243
-			'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
243
+			'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
244 244
 			'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
245 245
 			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
246 246
 		];
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 			'uri' => $row['uri'],
271 271
 			'principaluri' => $row['principaluri'],
272 272
 			'{DAV:}displayname' => $row['displayname'],
273
-			'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
273
+			'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
274 274
 			'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
275 275
 			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
276 276
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 
279 279
 		// system address books are always read only
280 280
 		if ($principal === 'principals/system/system') {
281
-			$addressBook['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'] = $row['principaluri'];
282
-			$addressBook['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'] = true;
281
+			$addressBook['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'] = $row['principaluri'];
282
+			$addressBook['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'] = true;
283 283
 		}
284 284
 
285 285
 		$this->addOwnerPrincipal($addressBook);
@@ -306,22 +306,22 @@  discard block
 block discarded – undo
306 306
 	public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) {
307 307
 		$supportedProperties = [
308 308
 			'{DAV:}displayname',
309
-			'{' . Plugin::NS_CARDDAV . '}addressbook-description',
309
+			'{'.Plugin::NS_CARDDAV.'}addressbook-description',
310 310
 		];
311 311
 
312
-		$propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) {
312
+		$propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) {
313 313
 			$updates = [];
314 314
 			foreach ($mutations as $property => $newValue) {
315 315
 				switch ($property) {
316 316
 					case '{DAV:}displayname':
317 317
 						$updates['displayname'] = $newValue;
318 318
 						break;
319
-					case '{' . Plugin::NS_CARDDAV . '}addressbook-description':
319
+					case '{'.Plugin::NS_CARDDAV.'}addressbook-description':
320 320
 						$updates['description'] = $newValue;
321 321
 						break;
322 322
 				}
323 323
 			}
324
-			[$addressBookRow, $shares] = $this->atomic(function () use ($addressBookId, $updates) {
324
+			[$addressBookRow, $shares] = $this->atomic(function() use ($addressBookId, $updates) {
325 325
 				$query = $this->db->getQueryBuilder();
326 326
 				$query->update('addressbooks');
327 327
 
@@ -333,12 +333,12 @@  discard block
 block discarded – undo
333 333
 
334 334
 				$this->addChange($addressBookId, '', 2);
335 335
 
336
-				$addressBookRow = $this->getAddressBookById((int)$addressBookId);
337
-				$shares = $this->getShares((int)$addressBookId);
336
+				$addressBookRow = $this->getAddressBookById((int) $addressBookId);
337
+				$shares = $this->getShares((int) $addressBookId);
338 338
 				return [$addressBookRow, $shares];
339 339
 			}, $this->db);
340 340
 
341
-			$this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int)$addressBookId, $addressBookRow, $shares, $mutations));
341
+			$this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int) $addressBookId, $addressBookRow, $shares, $mutations));
342 342
 
343 343
 			return true;
344 344
 		});
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
 				case '{DAV:}displayname':
373 373
 					$values['displayname'] = $newValue;
374 374
 					break;
375
-				case '{' . Plugin::NS_CARDDAV . '}addressbook-description':
375
+				case '{'.Plugin::NS_CARDDAV.'}addressbook-description':
376 376
 					$values['description'] = $newValue;
377 377
 					break;
378 378
 				default:
379
-					throw new BadRequest('Unknown property: ' . $property);
379
+					throw new BadRequest('Unknown property: '.$property);
380 380
 			}
381 381
 		}
382 382
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 			$values['displayname'] = $url;
387 387
 		}
388 388
 
389
-		[$addressBookId, $addressBookRow] = $this->atomic(function () use ($values) {
389
+		[$addressBookId, $addressBookRow] = $this->atomic(function() use ($values) {
390 390
 			$query = $this->db->getQueryBuilder();
391 391
 			$query->insert('addressbooks')
392 392
 				->values([
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 	 * @return void
419 419
 	 */
420 420
 	public function deleteAddressBook($addressBookId) {
421
-		$this->atomic(function () use ($addressBookId): void {
422
-			$addressBookId = (int)$addressBookId;
421
+		$this->atomic(function() use ($addressBookId): void {
422
+			$addressBookId = (int) $addressBookId;
423 423
 			$addressBookData = $this->getAddressBookById($addressBookId);
424 424
 			$shares = $this->getShares($addressBookId);
425 425
 
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 
484 484
 		$result = $query->executeQuery();
485 485
 		while ($row = $result->fetch()) {
486
-			$row['etag'] = '"' . $row['etag'] . '"';
486
+			$row['etag'] = '"'.$row['etag'].'"';
487 487
 
488 488
 			$modified = false;
489 489
 			$row['carddata'] = $this->readBlob($row['carddata'], $modified);
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 		if (!$row) {
524 524
 			return false;
525 525
 		}
526
-		$row['etag'] = '"' . $row['etag'] . '"';
526
+		$row['etag'] = '"'.$row['etag'].'"';
527 527
 
528 528
 		$modified = false;
529 529
 		$row['carddata'] = $this->readBlob($row['carddata'], $modified);
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 			$result = $query->executeQuery();
566 566
 
567 567
 			while ($row = $result->fetch()) {
568
-				$row['etag'] = '"' . $row['etag'] . '"';
568
+				$row['etag'] = '"'.$row['etag'].'"';
569 569
 
570 570
 				$modified = false;
571 571
 				$row['carddata'] = $this->readBlob($row['carddata'], $modified);
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 	public function createCard($addressBookId, $cardUri, $cardData, bool $checkAlreadyExists = true) {
610 610
 		$etag = md5($cardData);
611 611
 		$uid = $this->getUID($cardData);
612
-		return $this->atomic(function () use ($addressBookId, $cardUri, $cardData, $checkAlreadyExists, $etag, $uid) {
612
+		return $this->atomic(function() use ($addressBookId, $cardUri, $cardData, $checkAlreadyExists, $etag, $uid) {
613 613
 			if ($checkAlreadyExists) {
614 614
 				$q = $this->db->getQueryBuilder();
615 615
 				$q->select('uid')
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 					->andWhere($q->expr()->eq('uid', $q->createNamedParameter($uid)))
619 619
 					->setMaxResults(1);
620 620
 				$result = $q->executeQuery();
621
-				$count = (bool)$result->fetchOne();
621
+				$count = (bool) $result->fetchOne();
622 622
 				$result->closeCursor();
623 623
 				if ($count) {
624 624
 					throw new \Sabre\DAV\Exception\BadRequest('VCard object with uid already exists in this addressbook collection.');
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 			$objectRow = $this->getCard($addressBookId, $cardUri);
650 650
 			$this->dispatcher->dispatchTyped(new CardCreatedEvent($addressBookId, $addressBookData, $shares, $objectRow));
651 651
 
652
-			return '"' . $etag . '"';
652
+			return '"'.$etag.'"';
653 653
 		}, $this->db);
654 654
 	}
655 655
 
@@ -682,13 +682,13 @@  discard block
 block discarded – undo
682 682
 		$uid = $this->getUID($cardData);
683 683
 		$etag = md5($cardData);
684 684
 
685
-		return $this->atomic(function () use ($addressBookId, $cardUri, $cardData, $uid, $etag) {
685
+		return $this->atomic(function() use ($addressBookId, $cardUri, $cardData, $uid, $etag) {
686 686
 			$query = $this->db->getQueryBuilder();
687 687
 
688 688
 			// check for recently stored etag and stop if it is the same
689 689
 			$etagCacheKey = "$addressBookId#$cardUri";
690 690
 			if (isset($this->etagCache[$etagCacheKey]) && $this->etagCache[$etagCacheKey] === $etag) {
691
-				return '"' . $etag . '"';
691
+				return '"'.$etag.'"';
692 692
 			}
693 693
 
694 694
 			$query->update($this->dbCardsTable)
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 			$shares = $this->getShares($addressBookId);
711 711
 			$objectRow = $this->getCard($addressBookId, $cardUri);
712 712
 			$this->dispatcher->dispatchTyped(new CardUpdatedEvent($addressBookId, $addressBookData, $shares, $objectRow));
713
-			return '"' . $etag . '"';
713
+			return '"'.$etag.'"';
714 714
 		}, $this->db);
715 715
 	}
716 716
 
@@ -718,12 +718,12 @@  discard block
 block discarded – undo
718 718
 	 * @throws Exception
719 719
 	 */
720 720
 	public function moveCard(int $sourceAddressBookId, string $sourceObjectUri, int $targetAddressBookId, string $tragetObjectUri): bool {
721
-		return $this->atomic(function () use ($sourceAddressBookId, $sourceObjectUri, $targetAddressBookId, $tragetObjectUri) {
721
+		return $this->atomic(function() use ($sourceAddressBookId, $sourceObjectUri, $targetAddressBookId, $tragetObjectUri) {
722 722
 			$card = $this->getCard($sourceAddressBookId, $sourceObjectUri);
723 723
 			if (empty($card)) {
724 724
 				return false;
725 725
 			}
726
-			$sourceObjectId = (int)$card['id'];
726
+			$sourceObjectId = (int) $card['id'];
727 727
 
728 728
 			$query = $this->db->getQueryBuilder();
729 729
 			$query->update('cards')
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 	 * @return bool
767 767
 	 */
768 768
 	public function deleteCard($addressBookId, $cardUri) {
769
-		return $this->atomic(function () use ($addressBookId, $cardUri) {
769
+		return $this->atomic(function() use ($addressBookId, $cardUri) {
770 770
 			$addressBookData = $this->getAddressBookById($addressBookId);
771 771
 			$shares = $this->getShares($addressBookId);
772 772
 			$objectRow = $this->getCard($addressBookId, $cardUri);
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 		$maxLimit = $this->config->getSystemValueInt('carddav_sync_request_truncation', 2500);
857 857
 		$limit = ($limit === null) ? $maxLimit : min($limit, $maxLimit);
858 858
 		// Current synctoken
859
-		return $this->atomic(function () use ($addressBookId, $syncToken, $syncLevel, $limit) {
859
+		return $this->atomic(function() use ($addressBookId, $syncToken, $syncLevel, $limit) {
860 860
 			$qb = $this->db->getQueryBuilder();
861 861
 			$qb->select('synctoken')
862 862
 				->from('addressbooks')
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 				} else {
901 901
 					$lastID = $values[array_key_last($values)]['id'];
902 902
 					$result['added'] = array_column($values, 'uri');
903
-					$result['syncToken'] = count($result['added']) >= $limit ? "init_{$lastID}_$initialSyncToken" : $initialSyncToken ;
903
+					$result['syncToken'] = count($result['added']) >= $limit ? "init_{$lastID}_$initialSyncToken" : $initialSyncToken;
904 904
 					$result['result_truncated'] = count($result['added']) >= $limit;
905 905
 				}
906 906
 			} elseif ($syncToken) {
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 				}
985 985
 				$lastID = $values[array_key_last($values)]['id'];
986 986
 				if (count($values) >= $limit) {
987
-					$result['syncToken'] = 'init_' . $lastID . '_' . $currentToken;
987
+					$result['syncToken'] = 'init_'.$lastID.'_'.$currentToken;
988 988
 					$result['result_truncated'] = true;
989 989
 				}
990 990
 
@@ -1005,13 +1005,13 @@  discard block
 block discarded – undo
1005 1005
 	 * @return void
1006 1006
 	 */
1007 1007
 	protected function addChange(int $addressBookId, string $objectUri, int $operation): void {
1008
-		$this->atomic(function () use ($addressBookId, $objectUri, $operation): void {
1008
+		$this->atomic(function() use ($addressBookId, $objectUri, $operation): void {
1009 1009
 			$query = $this->db->getQueryBuilder();
1010 1010
 			$query->select('synctoken')
1011 1011
 				->from('addressbooks')
1012 1012
 				->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId)));
1013 1013
 			$result = $query->executeQuery();
1014
-			$syncToken = (int)$result->fetchOne();
1014
+			$syncToken = (int) $result->fetchOne();
1015 1015
 			$result->closeCursor();
1016 1016
 
1017 1017
 			$query = $this->db->getQueryBuilder();
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 	 * @param list<string> $remove
1081 1081
 	 */
1082 1082
 	public function updateShares(IShareable $shareable, array $add, array $remove): void {
1083
-		$this->atomic(function () use ($shareable, $add, $remove): void {
1083
+		$this->atomic(function() use ($shareable, $add, $remove): void {
1084 1084
 			$addressBookId = $shareable->getResourceId();
1085 1085
 			$addressBookData = $this->getAddressBookById($addressBookId);
1086 1086
 			$oldShares = $this->getShares($addressBookId);
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 	 * @return array an array of contacts which are arrays of key-value-pairs
1108 1108
 	 */
1109 1109
 	public function search($addressBookId, $pattern, $searchProperties, $options = []): array {
1110
-		return $this->atomic(function () use ($addressBookId, $pattern, $searchProperties, $options) {
1110
+		return $this->atomic(function() use ($addressBookId, $pattern, $searchProperties, $options) {
1111 1111
 			return $this->searchByAddressBookIds([$addressBookId], $pattern, $searchProperties, $options);
1112 1112
 		}, $this->db);
1113 1113
 	}
@@ -1125,9 +1125,9 @@  discard block
 block discarded – undo
1125 1125
 		string $pattern,
1126 1126
 		array $searchProperties,
1127 1127
 		array $options = []): array {
1128
-		return $this->atomic(function () use ($principalUri, $pattern, $searchProperties, $options) {
1129
-			$addressBookIds = array_map(static function ($row):int {
1130
-				return (int)$row['id'];
1128
+		return $this->atomic(function() use ($principalUri, $pattern, $searchProperties, $options) {
1129
+			$addressBookIds = array_map(static function($row):int {
1130
+				return (int) $row['id'];
1131 1131
 			}, $this->getAddressBooksForUser($principalUri));
1132 1132
 
1133 1133
 			return $this->searchByAddressBookIds($addressBookIds, $pattern, $searchProperties, $options);
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 		$useWildcards = !\array_key_exists('wildcard', $options) || $options['wildcard'] !== false;
1163 1163
 
1164 1164
 		if ($escapePattern) {
1165
-			$searchProperties = array_filter($searchProperties, function ($property) use ($pattern) {
1165
+			$searchProperties = array_filter($searchProperties, function($property) use ($pattern) {
1166 1166
 				if ($property === 'EMAIL' && str_contains($pattern, ' ')) {
1167 1167
 					// There can be no spaces in emails
1168 1168
 					return false;
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 			} elseif (!$escapePattern) {
1196 1196
 				$query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter($pattern)));
1197 1197
 			} else {
1198
-				$query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
1198
+				$query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%')));
1199 1199
 			}
1200 1200
 		}
1201 1201
 		if (isset($options['limit'])) {
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 		}
1207 1207
 
1208 1208
 		if (isset($options['person'])) {
1209
-			$query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%' . $this->db->escapeLikeParameter($options['person']) . '%')));
1209
+			$query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%'.$this->db->escapeLikeParameter($options['person']).'%')));
1210 1210
 		}
1211 1211
 		if (isset($options['since']) || isset($options['until'])) {
1212 1212
 			$query2->join('cp', $this->dbCardsPropertiesTable, 'cp_bday', 'cp.cardid = cp_bday.cardid');
@@ -1234,8 +1234,8 @@  discard block
 block discarded – undo
1234 1234
 		$result = $query2->executeQuery();
1235 1235
 		$matches = $result->fetchAll();
1236 1236
 		$result->closeCursor();
1237
-		$matches = array_map(function ($match) {
1238
-			return (int)$match['cardid'];
1237
+		$matches = array_map(function($match) {
1238
+			return (int) $match['cardid'];
1239 1239
 		}, $matches);
1240 1240
 
1241 1241
 		$cardResults = [];
@@ -1252,8 +1252,8 @@  discard block
 block discarded – undo
1252 1252
 		}
1253 1253
 
1254 1254
 		$cards = array_merge(...$cardResults);
1255
-		return array_map(function ($array) {
1256
-			$array['addressbookid'] = (int)$array['addressbookid'];
1255
+		return array_map(function($array) {
1256
+			$array['addressbookid'] = (int) $array['addressbookid'];
1257 1257
 			$modified = false;
1258 1258
 			$array['carddata'] = $this->readBlob($array['carddata'], $modified);
1259 1259
 			if ($modified) {
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 		$result->closeCursor();
1300 1300
 
1301 1301
 		if (!isset($uri['uri'])) {
1302
-			throw new \InvalidArgumentException('Card does not exists: ' . $id);
1302
+			throw new \InvalidArgumentException('Card does not exists: '.$id);
1303 1303
 		}
1304 1304
 
1305 1305
 		return $uri['uri'];
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
 
1325 1325
 		if (is_array($contact)) {
1326 1326
 			$modified = false;
1327
-			$contact['etag'] = '"' . $contact['etag'] . '"';
1327
+			$contact['etag'] = '"'.$contact['etag'].'"';
1328 1328
 			$contact['carddata'] = $this->readBlob($contact['carddata'], $modified);
1329 1329
 			if ($modified) {
1330 1330
 				$contact['size'] = strlen($contact['carddata']);
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
 	 * @param string $vCardSerialized
1360 1360
 	 */
1361 1361
 	protected function updateProperties($addressBookId, $cardUri, $vCardSerialized) {
1362
-		$this->atomic(function () use ($addressBookId, $cardUri, $vCardSerialized): void {
1362
+		$this->atomic(function() use ($addressBookId, $cardUri, $vCardSerialized): void {
1363 1363
 			$cardId = $this->getCardId($addressBookId, $cardUri);
1364 1364
 			$vCard = $this->readCard($vCardSerialized);
1365 1365
 
@@ -1434,10 +1434,10 @@  discard block
 block discarded – undo
1434 1434
 		$result->closeCursor();
1435 1435
 
1436 1436
 		if (!isset($cardIds['id'])) {
1437
-			throw new \InvalidArgumentException('Card does not exists: ' . $uri);
1437
+			throw new \InvalidArgumentException('Card does not exists: '.$uri);
1438 1438
 		}
1439 1439
 
1440
-		return (int)$cardIds['id'];
1440
+		return (int) $cardIds['id'];
1441 1441
 	}
1442 1442
 
1443 1443
 	/**
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 			->from('addressbookchanges');
1466 1466
 
1467 1467
 		$result = $query->executeQuery();
1468
-		$maxId = (int)$result->fetchOne();
1468
+		$maxId = (int) $result->fetchOne();
1469 1469
 		$result->closeCursor();
1470 1470
 		if (!$maxId || $maxId < $keep) {
1471 1471
 			return 0;
@@ -1492,8 +1492,8 @@  discard block
 block discarded – undo
1492 1492
 	}
1493 1493
 
1494 1494
 	private function addOwnerPrincipal(array &$addressbookInfo): void {
1495
-		$ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
1496
-		$displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
1495
+		$ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal';
1496
+		$displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname';
1497 1497
 		if (isset($addressbookInfo[$ownerPrincipalKey])) {
1498 1498
 			$uri = $addressbookInfo[$ownerPrincipalKey];
1499 1499
 		} else {
Please login to merge, or discard this patch.