Passed
Push — master ( f0dd71...c56a27 )
by Christoph
11:49 queued 12s
created
apps/dav/lib/CardDAV/UserAddressBooks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 		$addressBooks = $this->carddavBackend->getAddressBooksForUser($this->principalUri);
74 74
 		/** @var IAddressBook[] $objects */
75
-		$objects = array_map(function (array $addressBook) {
75
+		$objects = array_map(function(array $addressBook) {
76 76
 			if ($addressBook['principaluri'] === 'principals/system/system') {
77 77
 				return new SystemAddressbook($this->carddavBackend, $addressBook, $this->l10n, $this->config);
78 78
 			}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 			return new AddressBook($this->carddavBackend, $addressBook, $this->l10n);
81 81
 		}, $addressBooks);
82 82
 		/** @var IAddressBook[][] $objectsFromPlugins */
83
-		$objectsFromPlugins = array_map(function (IAddressBookProvider $plugin): array {
83
+		$objectsFromPlugins = array_map(function(IAddressBookProvider $plugin): array {
84 84
 			return $plugin->fetchAllForAddressBookHome($this->principalUri);
85 85
 		}, $this->pluginManager->getAddressBookPlugins());
86 86
 
Please login to merge, or discard this patch.
apps/dav/lib/CardDAV/CardDavBackend.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			->from('addressbooks')
125 125
 			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
126 126
 
127
-		return (int)$query->execute()->fetchColumn();
127
+		return (int) $query->execute()->fetchColumn();
128 128
 	}
129 129
 
130 130
 	/**
@@ -155,15 +155,15 @@  discard block
 block discarded – undo
155 155
 		$addressBooks = [];
156 156
 
157 157
 		$result = $query->execute();
158
-		while($row = $result->fetch()) {
158
+		while ($row = $result->fetch()) {
159 159
 			$addressBooks[$row['id']] = [
160 160
 				'id'  => $row['id'],
161 161
 				'uri' => $row['uri'],
162 162
 				'principaluri' => $this->convertPrincipal($row['principaluri'], false),
163 163
 				'{DAV:}displayname' => $row['displayname'],
164
-				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
164
+				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
165 165
 				'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
166
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
166
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
167 167
 			];
168 168
 
169 169
 			$this->addOwnerPrincipal($addressBooks[$row['id']]);
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 		$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
175 175
 		$principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal));
176 176
 
177
-		$principals = array_map(function ($principal) {
177
+		$principals = array_map(function($principal) {
178 178
 			return urldecode($principal);
179 179
 		}, $principals);
180
-		$principals[]= $principalUri;
180
+		$principals[] = $principalUri;
181 181
 
182 182
 		$query = $this->db->getQueryBuilder();
183 183
 		$result = $query->select(['a.id', 'a.uri', 'a.displayname', 'a.principaluri', 'a.description', 'a.synctoken', 's.access'])
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 			->setParameter('principaluri', $principals, IQueryBuilder::PARAM_STR_ARRAY)
190 190
 			->execute();
191 191
 
192
-		$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
193
-		while($row = $result->fetch()) {
192
+		$readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only';
193
+		while ($row = $result->fetch()) {
194 194
 			if ($row['principaluri'] === $principalUri) {
195 195
 				continue;
196 196
 			}
@@ -209,18 +209,18 @@  discard block
 block discarded – undo
209 209
 			}
210 210
 
211 211
 			list(, $name) = \Sabre\Uri\split($row['principaluri']);
212
-			$uri = $row['uri'] . '_shared_by_' . $name;
213
-			$displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
212
+			$uri = $row['uri'].'_shared_by_'.$name;
213
+			$displayName = $row['displayname'].' ('.$this->getUserDisplayName($name).')';
214 214
 
215 215
 			$addressBooks[$row['id']] = [
216 216
 				'id'  => $row['id'],
217 217
 				'uri' => $uri,
218 218
 				'principaluri' => $principalUriOriginal,
219 219
 				'{DAV:}displayname' => $displayName,
220
-				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
220
+				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
221 221
 				'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
222
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
223
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'],
222
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
223
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'],
224 224
 				$readOnlyPropertyName => $readOnly,
225 225
 			];
226 226
 
@@ -241,15 +241,15 @@  discard block
 block discarded – undo
241 241
 		$addressBooks = [];
242 242
 
243 243
 		$result = $query->execute();
244
-		while($row = $result->fetch()) {
244
+		while ($row = $result->fetch()) {
245 245
 			$addressBooks[$row['id']] = [
246 246
 				'id'  => $row['id'],
247 247
 				'uri' => $row['uri'],
248 248
 				'principaluri' => $this->convertPrincipal($row['principaluri'], false),
249 249
 				'{DAV:}displayname' => $row['displayname'],
250
-				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
250
+				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
251 251
 				'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
252
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
252
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
253 253
 			];
254 254
 
255 255
 			$this->addOwnerPrincipal($addressBooks[$row['id']]);
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 			'uri' => $row['uri'],
295 295
 			'principaluri' => $row['principaluri'],
296 296
 			'{DAV:}displayname' => $row['displayname'],
297
-			'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
297
+			'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
298 298
 			'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
299
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
299
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
300 300
 		];
301 301
 
302 302
 		$this->addOwnerPrincipal($addressBook);
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
 			'uri' => $row['uri'],
329 329
 			'principaluri' => $row['principaluri'],
330 330
 			'{DAV:}displayname' => $row['displayname'],
331
-			'{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
331
+			'{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
332 332
 			'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
333
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
333
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
334 334
 		];
335 335
 
336 336
 		$this->addOwnerPrincipal($addressBook);
@@ -357,22 +357,22 @@  discard block
 block discarded – undo
357 357
 	function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) {
358 358
 		$supportedProperties = [
359 359
 			'{DAV:}displayname',
360
-			'{' . Plugin::NS_CARDDAV . '}addressbook-description',
360
+			'{'.Plugin::NS_CARDDAV.'}addressbook-description',
361 361
 		];
362 362
 
363 363
 		/**
364 364
 		 * @suppress SqlInjectionChecker
365 365
 		 */
366
-		$propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) {
366
+		$propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) {
367 367
 
368 368
 			$updates = [];
369
-			foreach($mutations as $property=>$newValue) {
369
+			foreach ($mutations as $property=>$newValue) {
370 370
 
371
-				switch($property) {
371
+				switch ($property) {
372 372
 					case '{DAV:}displayname' :
373 373
 						$updates['displayname'] = $newValue;
374 374
 						break;
375
-					case '{' . Plugin::NS_CARDDAV . '}addressbook-description' :
375
+					case '{'.Plugin::NS_CARDDAV.'}addressbook-description' :
376 376
 						$updates['description'] = $newValue;
377 377
 						break;
378 378
 				}
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 			$query = $this->db->getQueryBuilder();
381 381
 			$query->update('addressbooks');
382 382
 
383
-			foreach($updates as $key=>$value) {
383
+			foreach ($updates as $key=>$value) {
384 384
 				$query->set($key, $query->createNamedParameter($value));
385 385
 			}
386 386
 			$query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId)))
@@ -411,24 +411,24 @@  discard block
 block discarded – undo
411 411
 			'synctoken' => 1
412 412
 		];
413 413
 
414
-		foreach($properties as $property=>$newValue) {
414
+		foreach ($properties as $property=>$newValue) {
415 415
 
416
-			switch($property) {
416
+			switch ($property) {
417 417
 				case '{DAV:}displayname' :
418 418
 					$values['displayname'] = $newValue;
419 419
 					break;
420
-				case '{' . Plugin::NS_CARDDAV . '}addressbook-description' :
420
+				case '{'.Plugin::NS_CARDDAV.'}addressbook-description' :
421 421
 					$values['description'] = $newValue;
422 422
 					break;
423 423
 				default :
424
-					throw new BadRequest('Unknown property: ' . $property);
424
+					throw new BadRequest('Unknown property: '.$property);
425 425
 			}
426 426
 
427 427
 		}
428 428
 
429 429
 		// Fallback to make sure the displayname is set. Some clients may refuse
430 430
 		// to work with addressbooks not having a displayname.
431
-		if(is_null($values['displayname'])) {
431
+		if (is_null($values['displayname'])) {
432 432
 			$values['displayname'] = $url;
433 433
 		}
434 434
 
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 		$cards = [];
507 507
 
508 508
 		$result = $query->execute();
509
-		while($row = $result->fetch()) {
510
-			$row['etag'] = '"' . $row['etag'] . '"';
509
+		while ($row = $result->fetch()) {
510
+			$row['etag'] = '"'.$row['etag'].'"';
511 511
 			$row['carddata'] = $this->readBlob($row['carddata']);
512 512
 			$cards[] = $row;
513 513
 		}
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 		if (!$row) {
542 542
 			return false;
543 543
 		}
544
-		$row['etag'] = '"' . $row['etag'] . '"';
544
+		$row['etag'] = '"'.$row['etag'].'"';
545 545
 		$row['carddata'] = $this->readBlob($row['carddata']);
546 546
 
547 547
 		return $row;
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 			$result = $query->execute();
579 579
 
580 580
 			while ($row = $result->fetch()) {
581
-				$row['etag'] = '"' . $row['etag'] . '"';
581
+				$row['etag'] = '"'.$row['etag'].'"';
582 582
 				$row['carddata'] = $this->readBlob($row['carddata']);
583 583
 				$cards[] = $row;
584 584
 			}
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 				'cardUri' => $cardUri,
652 652
 				'cardData' => $cardData]));
653 653
 
654
-		return '"' . $etag . '"';
654
+		return '"'.$etag.'"';
655 655
 	}
656 656
 
657 657
 	/**
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 				'cardUri' => $cardUri,
704 704
 				'cardData' => $cardData]));
705 705
 
706
-		return '"' . $etag . '"';
706
+		return '"'.$etag.'"';
707 707
 	}
708 708
 
709 709
 	/**
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) {
802 802
 		// Current synctoken
803 803
 		$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?');
804
-		$stmt->execute([ $addressBookId ]);
804
+		$stmt->execute([$addressBookId]);
805 805
 		$currentToken = $stmt->fetchColumn(0);
806 806
 
807 807
 		if (is_null($currentToken)) return null;
@@ -816,8 +816,8 @@  discard block
 block discarded – undo
816 816
 		if ($syncToken) {
817 817
 
818 818
 			$query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`";
819
-			if ($limit>0) {
820
-				$query .= " LIMIT " . (int)$limit;
819
+			if ($limit > 0) {
820
+				$query .= " LIMIT ".(int) $limit;
821 821
 			}
822 822
 
823 823
 			// Fetching all changes
@@ -828,15 +828,15 @@  discard block
 block discarded – undo
828 828
 
829 829
 			// This loop ensures that any duplicates are overwritten, only the
830 830
 			// last change on a node is relevant.
831
-			while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
831
+			while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
832 832
 
833 833
 				$changes[$row['uri']] = $row['operation'];
834 834
 
835 835
 			}
836 836
 
837
-			foreach($changes as $uri => $operation) {
837
+			foreach ($changes as $uri => $operation) {
838 838
 
839
-				switch($operation) {
839
+				switch ($operation) {
840 840
 					case 1:
841 841
 						$result['added'][] = $uri;
842 842
 						break;
@@ -924,10 +924,10 @@  discard block
 block discarded – undo
924 924
 
925 925
 		// No need for like when the pattern is empty
926 926
 		if ('' !== $pattern) {
927
-			if(\array_key_exists('escape_like_param', $options) && $options['escape_like_param'] === false) {
927
+			if (\array_key_exists('escape_like_param', $options) && $options['escape_like_param'] === false) {
928 928
 				$query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter($pattern)));
929 929
 			} else {
930
-				$query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
930
+				$query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%')));
931 931
 			}
932 932
 		}
933 933
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 
940 940
 		$result->closeCursor();
941 941
 
942
-		return array_map(function ($array) {
942
+		return array_map(function($array) {
943 943
 			$array['carddata'] = $this->readBlob($array['carddata']);
944 944
 			return $array;
945 945
 		}, $cards);
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 		$result->closeCursor();
982 982
 
983 983
 		if (!isset($uri['uri'])) {
984
-			throw new \InvalidArgumentException('Card does not exists: ' . $id);
984
+			throw new \InvalidArgumentException('Card does not exists: '.$id);
985 985
 		}
986 986
 
987 987
 		return $uri['uri'];
@@ -1053,11 +1053,11 @@  discard block
 block discarded – undo
1053 1053
 			);
1054 1054
 
1055 1055
 		foreach ($vCard->children() as $property) {
1056
-			if(!in_array($property->name, self::$indexProperties)) {
1056
+			if (!in_array($property->name, self::$indexProperties)) {
1057 1057
 				continue;
1058 1058
 			}
1059 1059
 			$preferred = 0;
1060
-			foreach($property->parameters as $parameter) {
1060
+			foreach ($property->parameters as $parameter) {
1061 1061
 				if ($parameter->name === 'TYPE' && strtoupper($parameter->getValue()) === 'PREF') {
1062 1062
 					$preferred = 1;
1063 1063
 					break;
@@ -1112,10 +1112,10 @@  discard block
 block discarded – undo
1112 1112
 		$result->closeCursor();
1113 1113
 
1114 1114
 		if (!isset($cardIds['id'])) {
1115
-			throw new \InvalidArgumentException('Card does not exists: ' . $uri);
1115
+			throw new \InvalidArgumentException('Card does not exists: '.$uri);
1116 1116
 		}
1117 1117
 
1118
-		return (int)$cardIds['id'];
1118
+		return (int) $cardIds['id'];
1119 1119
 	}
1120 1120
 
1121 1121
 	/**
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
 	}
1141 1141
 
1142 1142
 	private function addOwnerPrincipal(&$addressbookInfo) {
1143
-		$ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
1144
-		$displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
1143
+		$ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal';
1144
+		$displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname';
1145 1145
 		if (isset($addressbookInfo[$ownerPrincipalKey])) {
1146 1146
 			$uri = $addressbookInfo[$ownerPrincipalKey];
1147 1147
 		} else {
Please login to merge, or discard this patch.
apps/dav/lib/CardDAV/SyncService.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 			if ($ex->getCode() === Http::STATUS_UNAUTHORIZED) {
101 101
 				// remote server revoked access to the address book, remove it
102 102
 				$this->backend->deleteAddressBook($addressBookId);
103
-				$this->logger->info('Authorization failed, remove address book: ' . $url, ['app' => 'dav']);
103
+				$this->logger->info('Authorization failed, remove address book: '.$url, ['app' => 'dav']);
104 104
 				throw $ex;
105 105
 			}
106 106
 		}
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	protected function getClient($url, $userName, $sharedSecret) {
175 175
 		$settings = [
176
-			'baseUri' => $url . '/',
176
+			'baseUri' => $url.'/',
177 177
 			'userName' => $userName,
178 178
 			'password' => $sharedSecret,
179 179
 		];
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	public function deleteUser($userOrCardId) {
299 299
 		$systemAddressBook = $this->getLocalSystemAddressBook();
300
-		if ($userOrCardId instanceof IUser){
300
+		if ($userOrCardId instanceof IUser) {
301 301
 			$name = $userOrCardId->getBackendClassName();
302 302
 			$userId = $userOrCardId->getUID();
303 303
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		if (is_null($this->localSystemAddressBook)) {
314 314
 			$systemPrincipal = "principals/system/system";
315 315
 			$this->localSystemAddressBook = $this->ensureSystemAddressBookExists($systemPrincipal, 'system', [
316
-				'{' . Plugin::NS_CARDDAV . '}addressbook-description' => 'System addressbook which holds all users of this instance'
316
+				'{'.Plugin::NS_CARDDAV.'}addressbook-description' => 'System addressbook which holds all users of this instance'
317 317
 			]);
318 318
 		}
319 319
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
 	public function syncInstance(\Closure $progressCallback = null) {
324 324
 		$systemAddressBook = $this->getLocalSystemAddressBook();
325
-		$this->userManager->callForSeenUsers(function ($user) use ($systemAddressBook, $progressCallback) {
325
+		$this->userManager->callForSeenUsers(function($user) use ($systemAddressBook, $progressCallback) {
326 326
 			$this->updateUser($user);
327 327
 			if (!is_null($progressCallback)) {
328 328
 				$progressCallback();
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 
332 332
 		// remove no longer existing
333 333
 		$allCards = $this->backend->getCards($systemAddressBook['id']);
334
-		foreach($allCards as $card) {
334
+		foreach ($allCards as $card) {
335 335
 			$vCard = Reader::read($card['carddata']);
336 336
 			$uid = $vCard->UID->getValue();
337 337
 			// load backend and see if user exists
Please login to merge, or discard this patch.
apps/dav/lib/CardDAV/AddressBook.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 	}
105 105
 
106 106
 	public function getACL() {
107
-		$acl =  [
107
+		$acl = [
108 108
 			[
109 109
 				'privilege' => '{DAV:}read',
110 110
 				'principal' => $this->getOwner(),
111 111
 				'protected' => true,
112
-			],[
112
+			], [
113 113
 				'privilege' => '{DAV:}write',
114 114
 				'principal' => $this->getOwner(),
115 115
 				'protected' => true,
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		}
130 130
 
131 131
 		if ($this->getOwner() !== parent::getOwner()) {
132
-			$acl[] =  [
132
+			$acl[] = [
133 133
 				'privilege' => '{DAV:}read',
134 134
 				'principal' => parent::getOwner(),
135 135
 				'protected' => true,
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 		$acl = $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl);
147 147
 		$allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/system'];
148
-		return array_filter($acl, function ($rule) use ($allowedPrincipals) {
148
+		return array_filter($acl, function($rule) use ($allowedPrincipals) {
149 149
 			return \in_array($rule['principal'], $allowedPrincipals, true);
150 150
 		});
151 151
 	}
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 
182 182
 	public function delete() {
183 183
 		if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) {
184
-			$principal = 'principal:' . parent::getOwner();
184
+			$principal = 'principal:'.parent::getOwner();
185 185
 			$shares = $this->carddavBackend->getShares($this->getResourceId());
186
-			$shares = array_filter($shares, function ($share) use ($principal) {
186
+			$shares = array_filter($shares, function($share) use ($principal) {
187 187
 				return $share['href'] === $principal;
188 188
 			});
189 189
 			if (empty($shares)) {
Please login to merge, or discard this patch.
apps/dav/lib/SystemTag/SystemTagPlugin.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 			if ($node instanceof SystemTagsObjectMappingCollection) {
136 136
 				// also add to collection
137 137
 				$node->createFile($tag->getId());
138
-				$url = $request->getBaseUrl() . 'systemtags/';
138
+				$url = $request->getBaseUrl().'systemtags/';
139 139
 			} else {
140 140
 				$url = $request->getUrl();
141 141
 			}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 				$url .= '/';
145 145
 			}
146 146
 
147
-			$response->setHeader('Content-Location', $url . $tag->getId());
147
+			$response->setHeader('Content-Location', $url.$tag->getId());
148 148
 
149 149
 			// created
150 150
 			$response->setStatus(201);
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 		$userAssignable = true;
180 180
 
181 181
 		if (isset($data['userVisible'])) {
182
-			$userVisible = (bool)$data['userVisible'];
182
+			$userVisible = (bool) $data['userVisible'];
183 183
 		}
184 184
 
185 185
 		if (isset($data['userAssignable'])) {
186
-			$userAssignable = (bool)$data['userAssignable'];
186
+			$userAssignable = (bool) $data['userAssignable'];
187 187
 		}
188 188
 
189 189
 		$groups = [];
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 			}
195 195
 		}
196 196
 
197
-		if($userVisible === false || $userAssignable === false || !empty($groups)) {
198
-			if(!$this->userSession->isLoggedIn() || !$this->groupManager->isAdmin($this->userSession->getUser()->getUID())) {
197
+		if ($userVisible === false || $userAssignable === false || !empty($groups)) {
198
+			if (!$this->userSession->isLoggedIn() || !$this->groupManager->isAdmin($this->userSession->getUser()->getUID())) {
199 199
 				throw new BadRequest('Not sufficient permissions');
200 200
 			}
201 201
 		}
@@ -226,29 +226,29 @@  discard block
 block discarded – undo
226 226
 			return;
227 227
 		}
228 228
 
229
-		$propFind->handle(self::ID_PROPERTYNAME, function () use ($node) {
229
+		$propFind->handle(self::ID_PROPERTYNAME, function() use ($node) {
230 230
 			return $node->getSystemTag()->getId();
231 231
 		});
232 232
 
233
-		$propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function () use ($node) {
233
+		$propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function() use ($node) {
234 234
 			return $node->getSystemTag()->getName();
235 235
 		});
236 236
 
237
-		$propFind->handle(self::USERVISIBLE_PROPERTYNAME, function () use ($node) {
237
+		$propFind->handle(self::USERVISIBLE_PROPERTYNAME, function() use ($node) {
238 238
 			return $node->getSystemTag()->isUserVisible() ? 'true' : 'false';
239 239
 		});
240 240
 
241
-		$propFind->handle(self::USERASSIGNABLE_PROPERTYNAME, function () use ($node) {
241
+		$propFind->handle(self::USERASSIGNABLE_PROPERTYNAME, function() use ($node) {
242 242
 			// this is the tag's inherent property "is user assignable"
243 243
 			return $node->getSystemTag()->isUserAssignable() ? 'true' : 'false';
244 244
 		});
245 245
 
246
-		$propFind->handle(self::CANASSIGN_PROPERTYNAME, function () use ($node) {
246
+		$propFind->handle(self::CANASSIGN_PROPERTYNAME, function() use ($node) {
247 247
 			// this is the effective permission for the current user
248 248
 			return $this->tagManager->canUserAssignTag($node->getSystemTag(), $this->userSession->getUser()) ? 'true' : 'false';
249 249
 		});
250 250
 
251
-		$propFind->handle(self::GROUPS_PROPERTYNAME, function () use ($node) {
251
+		$propFind->handle(self::GROUPS_PROPERTYNAME, function() use ($node) {
252 252
 			if (!$this->groupManager->isAdmin($this->userSession->getUser()->getUID())) {
253 253
 				// property only available for admins
254 254
 				throw new Forbidden();
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 			self::USERVISIBLE_PROPERTYNAME,
282 282
 			self::USERASSIGNABLE_PROPERTYNAME,
283 283
 			self::GROUPS_PROPERTYNAME,
284
-		], function ($props) use ($node) {
284
+		], function($props) use ($node) {
285 285
 			$tag = $node->getSystemTag();
286 286
 			$name = $tag->getName();
287 287
 			$userVisible = $tag->isUserVisible();
Please login to merge, or discard this patch.
apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@
 block discarded – undo
60 60
 				$tagMapper,
61 61
 				$userSession,
62 62
 				$groupManager,
63
-				function ($name) {
64
-					$nodes = \OC::$server->getUserFolder()->getById((int)$name);
63
+				function($name) {
64
+					$nodes = \OC::$server->getUserFolder()->getById((int) $name);
65 65
 					return !empty($nodes);
66 66
 				}
67 67
 			),
Please login to merge, or discard this patch.
apps/dav/lib/Controller/BirthdayCalendarController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
 		$this->config->setAppValue($this->appName, 'generateBirthdayCalendar', 'yes');
95 95
 
96 96
 		// add background job for each user
97
-		$this->userManager->callForSeenUsers(function (IUser $user) {
97
+		$this->userManager->callForSeenUsers(function(IUser $user) {
98 98
 			$this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [
99 99
 				'userId' => $user->getUID(),
100 100
 			]);
Please login to merge, or discard this patch.
apps/dav/lib/Comments/CommentNode.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 		$this->logger = $logger;
86 86
 
87 87
 		$methods = get_class_methods($this->comment);
88
-		$methods = array_filter($methods, function ($name) {
88
+		$methods = array_filter($methods, function($name) {
89 89
 			return strpos($name, 'get') === 0;
90 90
 		});
91
-		foreach($methods as $getter) {
92
-			if($getter === 'getMentions') {
93
-				continue;	// special treatment
91
+		foreach ($methods as $getter) {
92
+			if ($getter === 'getMentions') {
93
+				continue; // special treatment
94 94
 			}
95
-			$name = '{'.self::NS_OWNCLOUD.'}' . lcfirst(substr($getter, 3));
95
+			$name = '{'.self::NS_OWNCLOUD.'}'.lcfirst(substr($getter, 3));
96 96
 			$this->properties[$name] = $getter;
97 97
 		}
98 98
 		$this->userManager = $userManager;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
 	protected function checkWriteAccessOnComment() {
133 133
 		$user = $this->userSession->getUser();
134
-		if(    $this->comment->getActorType() !== 'users'
134
+		if ($this->comment->getActorType() !== 'users'
135 135
 			|| is_null($user)
136 136
 			|| $this->comment->getActorId() !== $user->getUID()
137 137
 		) {
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 			return true;
196 196
 		} catch (\Exception $e) {
197 197
 			$this->logger->logException($e, ['app' => 'dav/comments']);
198
-			if($e instanceof MessageTooLongException) {
198
+			if ($e instanceof MessageTooLongException) {
199 199
 				$msg = 'Message exceeds allowed character limit of ';
200
-				throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e);
200
+				throw new BadRequest($msg.IComment::MAX_MESSAGE_LENGTH, 0, $e);
201 201
 			}
202 202
 			throw $e;
203 203
 		}
@@ -239,14 +239,14 @@  discard block
 block discarded – undo
239 239
 		$properties = array_keys($this->properties);
240 240
 
241 241
 		$result = [];
242
-		foreach($properties as $property) {
242
+		foreach ($properties as $property) {
243 243
 			$getter = $this->properties[$property];
244
-			if(method_exists($this->comment, $getter)) {
244
+			if (method_exists($this->comment, $getter)) {
245 245
 				$result[$property] = $this->comment->$getter();
246 246
 			}
247 247
 		}
248 248
 
249
-		if($this->comment->getActorType() === 'users') {
249
+		if ($this->comment->getActorType() === 'users') {
250 250
 			$user = $this->userManager->get($this->comment->getActorId());
251 251
 			$displayName = is_null($user) ? null : $user->getDisplayName();
252 252
 			$result[self::PROPERTY_NAME_ACTOR_DISPLAYNAME] = $displayName;
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
 		$result[self::PROPERTY_NAME_MENTIONS] = $this->composeMentionsPropertyValue();
256 256
 
257 257
 		$unread = null;
258
-		$user =  $this->userSession->getUser();
259
-		if(!is_null($user)) {
258
+		$user = $this->userSession->getUser();
259
+		if (!is_null($user)) {
260 260
 			$readUntil = $this->commentsManager->getReadMark(
261 261
 				$this->comment->getObjectType(),
262 262
 				$this->comment->getObjectId(),
263 263
 				$user
264 264
 			);
265
-			if(is_null($readUntil)) {
265
+			if (is_null($readUntil)) {
266 266
 				$unread = 'true';
267 267
 			} else {
268 268
 				$unread = $this->comment->getCreationDateTime() > $readUntil;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 * @return array
284 284
 	 */
285 285
 	protected function composeMentionsPropertyValue() {
286
-		return array_map(function ($mention) {
286
+		return array_map(function($mention) {
287 287
 			try {
288 288
 				$displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']);
289 289
 			} catch (\OutOfBoundsException $e) {
Please login to merge, or discard this patch.
apps/dav/lib/Comments/CommentsPlugin.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	function initialize(Server $server) {
87 87
 		$this->server = $server;
88
-		if(strpos($this->server->getRequestUri(), 'comments/') !== 0) {
88
+		if (strpos($this->server->getRequestUri(), 'comments/') !== 0) {
89 89
 			return;
90 90
 		}
91 91
 
92 92
 		$this->server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc';
93 93
 
94
-		$this->server->xml->classMap['DateTime'] = function (Writer $writer, \DateTime $value) {
94
+		$this->server->xml->classMap['DateTime'] = function(Writer $writer, \DateTime $value) {
95 95
 			$writer->write(\Sabre\HTTP\toDate($value));
96 96
 		};
97 97
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		// having their own comments marked as unread
126 126
 		$node->setReadMarker(null);
127 127
 
128
-		$url = rtrim($request->getUrl(), '/') . '/' . urlencode($comment->getId());
128
+		$url = rtrim($request->getUrl(), '/').'/'.urlencode($comment->getId());
129 129
 
130 130
 		$response->setHeader('Content-Location', $url);
131 131
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function onReport($reportName, $report, $uri) {
160 160
 		$node = $this->server->tree->getNodeForPath($uri);
161
-		if(!$node instanceof EntityCollection || $reportName !== self::REPORT_NAME) {
161
+		if (!$node instanceof EntityCollection || $reportName !== self::REPORT_NAME) {
162 162
 			throw new ReportNotSupported();
163 163
 		}
164 164
 		$args = ['limit' => 0, 'offset' => 0, 'datetime' => null];
@@ -167,27 +167,27 @@  discard block
 block discarded – undo
167 167
 			$this::REPORT_PARAM_OFFSET,
168 168
 			$this::REPORT_PARAM_TIMESTAMP
169 169
 		];
170
-		$ns = '{' . $this::NS_OWNCLOUD . '}';
171
-		foreach($report as $parameter) {
172
-			if(!in_array($parameter['name'], $acceptableParameters) || empty($parameter['value'])) {
170
+		$ns = '{'.$this::NS_OWNCLOUD.'}';
171
+		foreach ($report as $parameter) {
172
+			if (!in_array($parameter['name'], $acceptableParameters) || empty($parameter['value'])) {
173 173
 				continue;
174 174
 			}
175 175
 			$args[str_replace($ns, '', $parameter['name'])] = $parameter['value'];
176 176
 		}
177 177
 
178
-		if(!is_null($args['datetime'])) {
178
+		if (!is_null($args['datetime'])) {
179 179
 			$args['datetime'] = new \DateTime($args['datetime']);
180 180
 		}
181 181
 
182 182
 		$results = $node->findChildren($args['limit'], $args['offset'], $args['datetime']);
183 183
 
184 184
 		$responses = [];
185
-		foreach($results as $node) {
186
-			$nodePath = $this->server->getRequestUri() . '/' . $node->comment->getId();
185
+		foreach ($results as $node) {
186
+			$nodePath = $this->server->getRequestUri().'/'.$node->comment->getId();
187 187
 			$resultSet = $this->server->getPropertiesForPath($nodePath, CommentNode::getPropertyNames());
188
-			if(isset($resultSet[0]) && isset($resultSet[0][200])) {
188
+			if (isset($resultSet[0]) && isset($resultSet[0][200])) {
189 189
 				$responses[] = new Response(
190
-					$this->server->getBaseUri() . $nodePath,
190
+					$this->server->getBaseUri().$nodePath,
191 191
 					[200 => $resultSet[0][200]],
192 192
 					200
193 193
 				);
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 
229 229
 		$actorType = $data['actorType'];
230 230
 		$actorId = null;
231
-		if($actorType === 'users') {
231
+		if ($actorType === 'users') {
232 232
 			$user = $this->userSession->getUser();
233
-			if(!is_null($user)) {
233
+			if (!is_null($user)) {
234 234
 				$actorId = $user->getUID();
235 235
 			}
236 236
 		}
237
-		if(is_null($actorId)) {
238
-			throw new BadRequest('Invalid actor "' .  $actorType .'"');
237
+		if (is_null($actorId)) {
238
+			throw new BadRequest('Invalid actor "'.$actorType.'"');
239 239
 		}
240 240
 
241 241
 		try {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 			throw new BadRequest('Invalid input values', 0, $e);
249 249
 		} catch (\OCP\Comments\MessageTooLongException $e) {
250 250
 			$msg = 'Message exceeds allowed character limit of ';
251
-			throw new BadRequest($msg . \OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0,	$e);
251
+			throw new BadRequest($msg.\OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0, $e);
252 252
 		}
253 253
 	}
254 254
 
Please login to merge, or discard this patch.