Completed
Push — master ( 065a97...5cc942 )
by Robin
41:56 queued 18:47
created
lib/private/Files/Node/Root.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		$this->userMountCache = $userMountCache;
85 85
 		$this->logger = $logger;
86 86
 		$this->userManager = $userManager;
87
-		$eventDispatcher->addListener(FilesystemTornDownEvent::class, function () {
87
+		$eventDispatcher->addListener(FilesystemTornDownEvent::class, function() {
88 88
 			$this->userFolderCache = new CappedMemoryCache();
89 89
 		});
90 90
 		$this->pathByIdCache = $cacheFactory->createLocal('path-by-id');
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 * @param bool $includeMounts
266 266
 	 * @return int|float
267 267
 	 */
268
-	public function getSize($includeMounts = true): int|float {
268
+	public function getSize($includeMounts = true): int | float {
269 269
 		return 0;
270 270
 	}
271 271
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	/**
315 315
 	 * @throws \OCP\Files\NotFoundException
316 316
 	 */
317
-	public function getParent(): INode|IRootFolder {
317
+	public function getParent(): INode | IRootFolder {
318 318
 		throw new NotFoundException();
319 319
 	}
320 320
 
@@ -356,15 +356,15 @@  discard block
 block discarded – undo
356 356
 		if (!$this->userFolderCache->hasKey($userId)) {
357 357
 			if ($this->mountManager->getSetupManager()->isSetupComplete($userObject)) {
358 358
 				try {
359
-					$folder = $this->get('/' . $userId . '/files');
359
+					$folder = $this->get('/'.$userId.'/files');
360 360
 					if (!$folder instanceof \OCP\Files\Folder) {
361 361
 						throw new \Exception("Account folder for \"$userId\" exists as a file");
362 362
 					}
363 363
 				} catch (NotFoundException $e) {
364
-					if (!$this->nodeExists('/' . $userId)) {
365
-						$this->newFolder('/' . $userId);
364
+					if (!$this->nodeExists('/'.$userId)) {
365
+						$this->newFolder('/'.$userId);
366 366
 					}
367
-					$folder = $this->newFolder('/' . $userId . '/files');
367
+					$folder = $this->newFolder('/'.$userId.'/files');
368 368
 				}
369 369
 			} else {
370 370
 				$folder = new LazyUserFolder($this, $userObject, $this->mountManager);
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	public function getFirstNodeByIdInPath(int $id, string $path): ?INode {
384 384
 		// scope the cache by user, so we don't return nodes for different users
385 385
 		if ($this->user) {
386
-			$cachedPath = $this->pathByIdCache->get($this->user->getUID() . '::' . $id);
386
+			$cachedPath = $this->pathByIdCache->get($this->user->getUID().'::'.$id);
387 387
 			if ($cachedPath && str_starts_with($cachedPath, $path)) {
388 388
 				// getting the node by path is significantly cheaper than finding it by id
389 389
 				try {
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 					if ($node && $node->getId() === $id) {
394 394
 						return $node;
395 395
 					}
396
-				} catch (NotFoundException|NotPermittedException) {
396
+				} catch (NotFoundException | NotPermittedException) {
397 397
 					// The file may be moved but the old path still in cache
398 398
 				}
399 399
 			}
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 		}
405 405
 
406 406
 		if ($this->user) {
407
-			$this->pathByIdCache->set($this->user->getUID() . '::' . $id, $node->getPath());
407
+			$this->pathByIdCache->set($this->user->getUID().'::'.$id, $node->getPath());
408 408
 		}
409 409
 		return $node;
410 410
 	}
@@ -435,20 +435,20 @@  discard block
 block discarded – undo
435 435
 		//
436 436
 		// so instead of using the cached entries directly, we instead filter the current mounts by the rootid of the cache entry
437 437
 
438
-		$mountRootIds = array_map(function ($mount) {
438
+		$mountRootIds = array_map(function($mount) {
439 439
 			return $mount->getRootId();
440 440
 		}, $mountsContainingFile);
441
-		$mountRootPaths = array_map(function ($mount) {
441
+		$mountRootPaths = array_map(function($mount) {
442 442
 			return $mount->getRootInternalPath();
443 443
 		}, $mountsContainingFile);
444
-		$mountProviders = array_unique(array_map(function ($mount) {
444
+		$mountProviders = array_unique(array_map(function($mount) {
445 445
 			return $mount->getMountProvider();
446 446
 		}, $mountsContainingFile));
447 447
 		$mountRoots = array_combine($mountRootIds, $mountRootPaths);
448 448
 
449 449
 		$mounts = $this->mountManager->getMountsByMountProvider($path, $mountProviders);
450 450
 
451
-		$mountsContainingFile = array_filter($mounts, function ($mount) use ($mountRoots) {
451
+		$mountsContainingFile = array_filter($mounts, function($mount) use ($mountRoots) {
452 452
 			return isset($mountRoots[$mount->getStorageRootId()]);
453 453
 		});
454 454
 
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 			return [];
465 465
 		}
466 466
 
467
-		$nodes = array_map(function (IMountPoint $mount) use ($id, $mountRoots) {
467
+		$nodes = array_map(function(IMountPoint $mount) use ($id, $mountRoots) {
468 468
 			$rootInternalPath = $mountRoots[$mount->getStorageRootId()];
469 469
 			$cacheEntry = $mount->getStorage()->getCache()->get($id);
470 470
 			if (!$cacheEntry) {
@@ -472,10 +472,10 @@  discard block
 block discarded – undo
472 472
 			}
473 473
 
474 474
 			// cache jails will hide the "true" internal path
475
-			$internalPath = ltrim($rootInternalPath . '/' . $cacheEntry->getPath(), '/');
475
+			$internalPath = ltrim($rootInternalPath.'/'.$cacheEntry->getPath(), '/');
476 476
 			$pathRelativeToMount = substr($internalPath, strlen($rootInternalPath));
477 477
 			$pathRelativeToMount = ltrim($pathRelativeToMount, '/');
478
-			$absolutePath = rtrim($mount->getMountPoint() . $pathRelativeToMount, '/');
478
+			$absolutePath = rtrim($mount->getMountPoint().$pathRelativeToMount, '/');
479 479
 			$storage = $mount->getStorage();
480 480
 			if ($storage === null) {
481 481
 				return null;
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
 
499 499
 		$nodes = array_filter($nodes);
500 500
 
501
-		$folders = array_filter($nodes, function (Node $node) use ($path) {
501
+		$folders = array_filter($nodes, function(Node $node) use ($path) {
502 502
 			return PathHelper::getRelativePath($path, $node->getPath()) !== null;
503 503
 		});
504
-		usort($folders, function ($a, $b) {
504
+		usort($folders, function($a, $b) {
505 505
 			return $b->getPath() <=> $a->getPath();
506 506
 		});
507 507
 		return $folders;
@@ -509,11 +509,11 @@  discard block
 block discarded – undo
509 509
 
510 510
 	public function getNodeFromCacheEntryAndMount(ICacheEntry $cacheEntry, IMountPoint $mountPoint): INode {
511 511
 		$path = $cacheEntry->getPath();
512
-		$fullPath = $mountPoint->getMountPoint() . $path;
512
+		$fullPath = $mountPoint->getMountPoint().$path;
513 513
 		// todo: LazyNode?
514 514
 		$info = new FileInfo($fullPath, $mountPoint->getStorage(), $path, $cacheEntry, $mountPoint);
515 515
 		$parentPath = dirname($fullPath);
516
-		$parent = new LazyFolder($this, function () use ($parentPath) {
516
+		$parent = new LazyFolder($this, function() use ($parentPath) {
517 517
 			$parent = $this->get($parentPath);
518 518
 			if ($parent instanceof \OCP\Files\Folder) {
519 519
 				return $parent;
Please login to merge, or discard this patch.