Completed
Push — master ( f6593a...d907a7 )
by John
29:27
created
apps/dav/lib/SystemTag/SystemTagPlugin.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			if ($node instanceof SystemTagsObjectMappingCollection) {
124 124
 				// also add to collection
125 125
 				$node->createFile($tag->getId());
126
-				$url = $request->getBaseUrl() . 'systemtags/';
126
+				$url = $request->getBaseUrl().'systemtags/';
127 127
 			} else {
128 128
 				$url = $request->getUrl();
129 129
 			}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 				$url .= '/';
133 133
 			}
134 134
 
135
-			$response->setHeader('Content-Location', $url . $tag->getId());
135
+			$response->setHeader('Content-Location', $url.$tag->getId());
136 136
 
137 137
 			// created
138 138
 			$response->setStatus(Http::STATUS_CREATED);
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 		$userAssignable = true;
168 168
 
169 169
 		if (isset($data['userVisible'])) {
170
-			$userVisible = (bool)$data['userVisible'];
170
+			$userVisible = (bool) $data['userVisible'];
171 171
 		}
172 172
 
173 173
 		if (isset($data['userAssignable'])) {
174
-			$userAssignable = (bool)$data['userAssignable'];
174
+			$userAssignable = (bool) $data['userAssignable'];
175 175
 		}
176 176
 
177 177
 		$groups = [];
@@ -262,37 +262,37 @@  discard block
 block discarded – undo
262 262
 			$propFind->setPath(str_replace('systemtags-assigned/', 'systemtags/', $propFind->getPath()));
263 263
 		}
264 264
 
265
-		$propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node): string {
266
-			return '"' . ($node->getSystemTag()->getETag() ?? '') . '"';
265
+		$propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function() use ($node): string {
266
+			return '"'.($node->getSystemTag()->getETag() ?? '').'"';
267 267
 		});
268 268
 
269
-		$propFind->handle(self::ID_PROPERTYNAME, function () use ($node) {
269
+		$propFind->handle(self::ID_PROPERTYNAME, function() use ($node) {
270 270
 			return $node->getSystemTag()->getId();
271 271
 		});
272 272
 
273
-		$propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function () use ($node) {
273
+		$propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function() use ($node) {
274 274
 			return $node->getSystemTag()->getName();
275 275
 		});
276 276
 
277
-		$propFind->handle(self::USERVISIBLE_PROPERTYNAME, function () use ($node) {
277
+		$propFind->handle(self::USERVISIBLE_PROPERTYNAME, function() use ($node) {
278 278
 			return $node->getSystemTag()->isUserVisible() ? 'true' : 'false';
279 279
 		});
280 280
 
281
-		$propFind->handle(self::USERASSIGNABLE_PROPERTYNAME, function () use ($node) {
281
+		$propFind->handle(self::USERASSIGNABLE_PROPERTYNAME, function() use ($node) {
282 282
 			// this is the tag's inherent property "is user assignable"
283 283
 			return $node->getSystemTag()->isUserAssignable() ? 'true' : 'false';
284 284
 		});
285 285
 
286
-		$propFind->handle(self::CANASSIGN_PROPERTYNAME, function () use ($node) {
286
+		$propFind->handle(self::CANASSIGN_PROPERTYNAME, function() use ($node) {
287 287
 			// this is the effective permission for the current user
288 288
 			return $this->tagManager->canUserAssignTag($node->getSystemTag(), $this->userSession->getUser()) ? 'true' : 'false';
289 289
 		});
290 290
 
291
-		$propFind->handle(self::COLOR_PROPERTYNAME, function () use ($node) {
291
+		$propFind->handle(self::COLOR_PROPERTYNAME, function() use ($node) {
292 292
 			return $node->getSystemTag()->getColor() ?? '';
293 293
 		});
294 294
 
295
-		$propFind->handle(self::GROUPS_PROPERTYNAME, function () use ($node) {
295
+		$propFind->handle(self::GROUPS_PROPERTYNAME, function() use ($node) {
296 296
 			if (!$this->groupManager->isAdmin($this->userSession->getUser()->getUID())) {
297 297
 				// property only available for admins
298 298
 				throw new Forbidden();
@@ -306,15 +306,15 @@  discard block
 block discarded – undo
306 306
 		});
307 307
 
308 308
 		if ($node instanceof SystemTagNode) {
309
-			$propFind->handle(self::NUM_FILES_PROPERTYNAME, function () use ($node): int {
309
+			$propFind->handle(self::NUM_FILES_PROPERTYNAME, function() use ($node): int {
310 310
 				return $node->getNumberOfFiles();
311 311
 			});
312 312
 
313
-			$propFind->handle(self::REFERENCE_FILEID_PROPERTYNAME, function () use ($node): int {
313
+			$propFind->handle(self::REFERENCE_FILEID_PROPERTYNAME, function() use ($node): int {
314 314
 				return $node->getReferenceFileId();
315 315
 			});
316 316
 
317
-			$propFind->handle(self::OBJECTIDS_PROPERTYNAME, function () use ($node): SystemTagsObjectList {
317
+			$propFind->handle(self::OBJECTIDS_PROPERTYNAME, function() use ($node): SystemTagsObjectList {
318 318
 				$objectTypes = $this->tagMapper->getAvailableObjectTypes();
319 319
 				$objects = [];
320 320
 				foreach ($objectTypes as $type) {
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		}
327 327
 
328 328
 		if ($node instanceof SystemTagObjectType) {
329
-			$propFind->handle(self::OBJECTIDS_PROPERTYNAME, function () use ($node): SystemTagsObjectList {
329
+			$propFind->handle(self::OBJECTIDS_PROPERTYNAME, function() use ($node): SystemTagsObjectList {
330 330
 				return new SystemTagsObjectList(array_fill_keys($node->getObjectsIds(), $node->getName()));
331 331
 			});
332 332
 		}
@@ -334,11 +334,11 @@  discard block
 block discarded – undo
334 334
 
335 335
 	private function propfindForFile(PropFind $propFind, Node $node): void {
336 336
 
337
-		$propFind->handle(self::SYSTEM_TAGS_PROPERTYNAME, function () use ($node) {
337
+		$propFind->handle(self::SYSTEM_TAGS_PROPERTYNAME, function() use ($node) {
338 338
 			$user = $this->userSession->getUser();
339 339
 
340 340
 			$tags = $this->getTagsForFile($node->getId(), $user);
341
-			usort($tags, function (ISystemTag $tagA, ISystemTag $tagB): int {
341
+			usort($tags, function(ISystemTag $tagA, ISystemTag $tagB): int {
342 342
 				return Util::naturalSortCompare($tagA->getName(), $tagB->getName());
343 343
 			});
344 344
 			return new SystemTagList($tags, $this->tagManager, $user);
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
 			}
363 363
 		}
364 364
 
365
-		$tags = array_filter(array_map(function (string $tagId) {
365
+		$tags = array_filter(array_map(function(string $tagId) {
366 366
 			return $this->cachedTags[$tagId] ?? null;
367 367
 		}, $tagIds));
368 368
 
369
-		$uncachedTagIds = array_filter($tagIds, function (string $tagId): bool {
369
+		$uncachedTagIds = array_filter($tagIds, function(string $tagId): bool {
370 370
 			return !isset($this->cachedTags[$tagId]);
371 371
 		});
372 372
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 			$tags += $retrievedTags;
379 379
 		}
380 380
 
381
-		return array_filter($tags, function (ISystemTag $tag) use ($user) {
381
+		return array_filter($tags, function(ISystemTag $tag) use ($user) {
382 382
 			return $this->tagManager->canUserSeeTag($tag, $user);
383 383
 		});
384 384
 	}
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 			return;
398 398
 		}
399 399
 
400
-		$propPatch->handle([self::OBJECTIDS_PROPERTYNAME], function ($props) use ($node) {
400
+		$propPatch->handle([self::OBJECTIDS_PROPERTYNAME], function($props) use ($node) {
401 401
 			if (!$node instanceof SystemTagObjectType) {
402 402
 				return false;
403 403
 			}
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 				$objectTypes = array_unique(array_values($objects));
418 418
 
419 419
 				if (count($objectTypes) !== 1 || $objectTypes[0] !== $node->getName()) {
420
-					throw new BadRequest('Invalid object-ids property. All object types must be of the same type: ' . $node->getName());
420
+					throw new BadRequest('Invalid object-ids property. All object types must be of the same type: '.$node->getName());
421 421
 				}
422 422
 
423 423
 				// Only files are supported at the moment
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 
429 429
 				// Get all current tagged objects
430 430
 				$taggedObjects = $this->tagMapper->getObjectIdsForTags([$node->getSystemTag()->getId()], 'files');
431
-				$toAddObjects = array_map(fn ($value) => (string)$value, array_keys($objects));
431
+				$toAddObjects = array_map(fn ($value) => (string) $value, array_keys($objects));
432 432
 
433 433
 				// Compute the tags to add and remove
434 434
 				$addedObjects = array_values(array_diff($toAddObjects, $taggedObjects));
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 			self::NUM_FILES_PROPERTYNAME,
464 464
 			self::REFERENCE_FILEID_PROPERTYNAME,
465 465
 			self::COLOR_PROPERTYNAME,
466
-		], function ($props) use ($node) {
466
+		], function($props) use ($node) {
467 467
 			if (!$node instanceof SystemTagNode) {
468 468
 				return false;
469 469
 			}
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 
543 543
 		foreach ($fileIds as $fileId) {
544 544
 			try {
545
-				$nodes = $userFolder->getById((int)$fileId);
545
+				$nodes = $userFolder->getById((int) $fileId);
546 546
 				if (empty($nodes)) {
547 547
 					return false;
548 548
 				}
Please login to merge, or discard this patch.