Passed
Push — master ( 6af36c...3efd9a )
by Roeland
11:04 queued 11s
created
lib/private/Files/Node/Folder.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		if (!$this->isValidPath($path)) {
57 57
 			throw new NotPermittedException('Invalid path');
58 58
 		}
59
-		return $this->path . $this->normalizePath($path);
59
+		return $this->path.$this->normalizePath($path);
60 60
 	}
61 61
 
62 62
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		}
70 70
 		if ($path === $this->path) {
71 71
 			return '/';
72
-		} else if (strpos($path, $this->path . '/') !== 0) {
72
+		} else if (strpos($path, $this->path.'/') !== 0) {
73 73
 			return null;
74 74
 		} else {
75 75
 			$path = substr($path, strlen($this->path));
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @return bool
85 85
 	 */
86 86
 	public function isSubNode($node) {
87
-		return strpos($node->getPath(), $this->path . '/') === 0;
87
+		return strpos($node->getPath(), $this->path.'/') === 0;
88 88
 	}
89 89
 
90 90
 	/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	public function getDirectoryListing() {
97 97
 		$folderContent = $this->view->getDirectoryContent($this->path);
98 98
 
99
-		return array_map(function (FileInfo $info) {
99
+		return array_map(function(FileInfo $info) {
100 100
 			if ($info->getMimetype() === 'httpd/unix-directory') {
101 101
 				return new Folder($this->root, $this->view, $info->getPath(), $info);
102 102
 			} else {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			$fullPath = $this->getFullPath($path);
158 158
 			$nonExisting = new NonExistingFolder($this->root, $this->view, $fullPath);
159 159
 			$this->sendHooks(['preWrite', 'preCreate'], [$nonExisting]);
160
-			if(!$this->view->mkdir($fullPath)) {
160
+			if (!$this->view->mkdir($fullPath)) {
161 161
 				throw new NotPermittedException('Could not create folder');
162 162
 			}
163 163
 			$node = new Folder($this->root, $this->view, $fullPath);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	public function search($query) {
198 198
 		if (is_string($query)) {
199
-			return $this->searchCommon('search', array('%' . $query . '%'));
199
+			return $this->searchCommon('search', array('%'.$query.'%'));
200 200
 		} else {
201 201
 			return $this->searchCommon('searchQuery', array($query));
202 202
 		}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		$internalPath = $mount->getInternalPath($this->path);
237 237
 		$internalPath = rtrim($internalPath, '/');
238 238
 		if ($internalPath !== '') {
239
-			$internalPath = $internalPath . '/';
239
+			$internalPath = $internalPath.'/';
240 240
 		}
241 241
 		$internalRootLength = strlen($internalPath);
242 242
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 				$result['internalPath'] = $result['path'];
249 249
 				$result['path'] = substr($result['path'], $internalRootLength);
250 250
 				$result['storage'] = $storage;
251
-				$files[] = new \OC\Files\FileInfo($this->path . '/' . $result['path'], $storage, $result['internalPath'], $result, $mount);
251
+				$files[] = new \OC\Files\FileInfo($this->path.'/'.$result['path'], $storage, $result['internalPath'], $result, $mount);
252 252
 			}
253 253
 		}
254 254
 
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
 				$results = call_user_func_array(array($cache, $method), $args);
263 263
 				foreach ($results as $result) {
264 264
 					$result['internalPath'] = $result['path'];
265
-					$result['path'] = $relativeMountPoint . $result['path'];
265
+					$result['path'] = $relativeMountPoint.$result['path'];
266 266
 					$result['storage'] = $storage;
267
-					$files[] = new \OC\Files\FileInfo($this->path . '/' . $result['path'], $storage, $result['internalPath'], $result, $mount);
267
+					$files[] = new \OC\Files\FileInfo($this->path.'/'.$result['path'], $storage, $result['internalPath'], $result, $mount);
268 268
 				}
269 269
 			}
270 270
 		}
271 271
 
272
-		return array_map(function (FileInfo $file) {
272
+		return array_map(function(FileInfo $file) {
273 273
 			return $this->createNode($file->getPath(), $file);
274 274
 		}, $files);
275 275
 	}
@@ -285,16 +285,16 @@  discard block
 block discarded – undo
285 285
 		} else {
286 286
 			$user = null;
287 287
 		}
288
-		$mountsContainingFile = $mountCache->getMountsForFileId((int)$id, $user);
288
+		$mountsContainingFile = $mountCache->getMountsForFileId((int) $id, $user);
289 289
 		$mounts = $this->root->getMountsIn($this->path);
290 290
 		$mounts[] = $this->root->getMount($this->path);
291 291
 		/** @var IMountPoint[] $folderMounts */
292
-		$folderMounts = array_combine(array_map(function (IMountPoint $mountPoint) {
292
+		$folderMounts = array_combine(array_map(function(IMountPoint $mountPoint) {
293 293
 			return $mountPoint->getMountPoint();
294 294
 		}, $mounts), $mounts);
295 295
 
296 296
 		/** @var ICachedMountInfo[] $mountsContainingFile */
297
-		$mountsContainingFile = array_values(array_filter($mountsContainingFile, function (ICachedMountInfo $cachedMountInfo) use ($folderMounts) {
297
+		$mountsContainingFile = array_values(array_filter($mountsContainingFile, function(ICachedMountInfo $cachedMountInfo) use ($folderMounts) {
298 298
 			return isset($folderMounts[$cachedMountInfo->getMountPoint()]);
299 299
 		}));
300 300
 
@@ -305,18 +305,18 @@  discard block
 block discarded – undo
305 305
 			return [];
306 306
 		}
307 307
 
308
-		$nodes = array_map(function (ICachedMountInfo $cachedMountInfo) use ($folderMounts, $id) {
308
+		$nodes = array_map(function(ICachedMountInfo $cachedMountInfo) use ($folderMounts, $id) {
309 309
 			$mount = $folderMounts[$cachedMountInfo->getMountPoint()];
310
-			$cacheEntry = $mount->getStorage()->getCache()->get((int)$id);
310
+			$cacheEntry = $mount->getStorage()->getCache()->get((int) $id);
311 311
 			if (!$cacheEntry) {
312 312
 				return null;
313 313
 			}
314 314
 
315 315
 			// cache jails will hide the "true" internal path
316
-			$internalPath = ltrim($cachedMountInfo->getRootInternalPath() . '/' . $cacheEntry->getPath(), '/');
316
+			$internalPath = ltrim($cachedMountInfo->getRootInternalPath().'/'.$cacheEntry->getPath(), '/');
317 317
 			$pathRelativeToMount = substr($internalPath, strlen($cachedMountInfo->getRootInternalPath()));
318 318
 			$pathRelativeToMount = ltrim($pathRelativeToMount, '/');
319
-			$absolutePath = rtrim($cachedMountInfo->getMountPoint() . $pathRelativeToMount, '/');
319
+			$absolutePath = rtrim($cachedMountInfo->getMountPoint().$pathRelativeToMount, '/');
320 320
 			return $this->root->createNode($absolutePath, new \OC\Files\FileInfo(
321 321
 				$absolutePath, $mount->getStorage(), $cacheEntry->getPath(), $cacheEntry, $mount,
322 322
 				\OC::$server->getUserManager()->get($mount->getStorage()->getOwner($pathRelativeToMount))
@@ -325,14 +325,14 @@  discard block
 block discarded – undo
325 325
 
326 326
 		$nodes = array_filter($nodes);
327 327
 
328
-		return array_filter($nodes, function (Node $node) {
328
+		return array_filter($nodes, function(Node $node) {
329 329
 			return $this->getRelativePath($node->getPath());
330 330
 		});
331 331
 	}
332 332
 
333 333
 	protected function getAppDataDirectoryName(): string {
334 334
 		$instanceId = \OC::$server->getConfig()->getSystemValueString('instanceid');
335
-		return 'appdata_' . $instanceId;
335
+		return 'appdata_'.$instanceId;
336 336
 	}
337 337
 
338 338
 	/**
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 			return [];
355 355
 		}
356 356
 
357
-		$absolutePath = '/' . ltrim($cacheEntry->getPath(), '/');
358
-		$currentPath = rtrim($this->path, '/') . '/';
357
+		$absolutePath = '/'.ltrim($cacheEntry->getPath(), '/');
358
+		$currentPath = rtrim($this->path, '/').'/';
359 359
 
360 360
 		if (strpos($absolutePath, $currentPath) !== 0) {
361 361
 			return [];
@@ -410,10 +410,10 @@  discard block
 block discarded – undo
410 410
 		$mounts = $this->root->getMountsIn($this->path);
411 411
 		$mounts[] = $this->getMountPoint();
412 412
 
413
-		$mounts = array_filter($mounts, function (IMountPoint $mount) {
413
+		$mounts = array_filter($mounts, function(IMountPoint $mount) {
414 414
 			return $mount->getStorage();
415 415
 		});
416
-		$storageIds = array_map(function (IMountPoint $mount) {
416
+		$storageIds = array_map(function(IMountPoint $mount) {
417 417
 			return $mount->getStorage()->getCache()->getNumericStorageId();
418 418
 		}, $mounts);
419 419
 		/** @var IMountPoint[] $mountMap */
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 	}
469 469
 
470 470
 	private function recentParse($result, $mountMap, $mimetypeLoader) {
471
-		$files = array_filter(array_map(function (array $entry) use ($mountMap, $mimetypeLoader) {
471
+		$files = array_filter(array_map(function(array $entry) use ($mountMap, $mimetypeLoader) {
472 472
 			$mount = $mountMap[$entry['storage']];
473 473
 			$entry['internalPath'] = $entry['path'];
474 474
 			$entry['mimetype'] = $mimetypeLoader->getMimetypeById($entry['mimetype']);
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 			return $this->root->createNode($fileInfo->getPath(), $fileInfo);
482 482
 		}, $result));
483 483
 
484
-		return array_values(array_filter($files, function (Node $node) {
484
+		return array_values(array_filter($files, function(Node $node) {
485 485
 			$cacheEntry = $node->getMountPoint()->getStorage()->getCache()->get($node->getId());
486 486
 			if (!$cacheEntry) {
487 487
 				return false;
@@ -503,13 +503,13 @@  discard block
 block discarded – undo
503 503
 			$rootLength = strlen($jailRoot) + 1;
504 504
 			if ($path === $jailRoot) {
505 505
 				return $mount->getMountPoint();
506
-			} else if (substr($path, 0, $rootLength) === $jailRoot . '/') {
507
-				return $mount->getMountPoint() . substr($path, $rootLength);
506
+			} else if (substr($path, 0, $rootLength) === $jailRoot.'/') {
507
+				return $mount->getMountPoint().substr($path, $rootLength);
508 508
 			} else {
509 509
 				return null;
510 510
 			}
511 511
 		} else {
512
-			return $mount->getMountPoint() . $path;
512
+			return $mount->getMountPoint().$path;
513 513
 		}
514 514
 	}
515 515
 }
Please login to merge, or discard this patch.