@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | if (!$this->isValidPath($path)) { |
70 | 70 | throw new NotPermittedException('Invalid path'); |
71 | 71 | } |
72 | - return $this->path . $this->normalizePath($path); |
|
72 | + return $this->path.$this->normalizePath($path); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return bool |
88 | 88 | */ |
89 | 89 | public function isSubNode($node) { |
90 | - return strpos($node->getPath(), $this->path . '/') === 0; |
|
90 | + return strpos($node->getPath(), $this->path.'/') === 0; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public function getDirectoryListing() { |
100 | 100 | $folderContent = $this->view->getDirectoryContent($this->path, '', $this->getFileInfo()); |
101 | 101 | |
102 | - return array_map(function (FileInfo $info) { |
|
102 | + return array_map(function(FileInfo $info) { |
|
103 | 103 | if ($info->getMimetype() === FileInfo::MIMETYPE_FOLDER) { |
104 | 104 | return new Folder($this->root, $this->view, $info->getPath(), $info, $this); |
105 | 105 | } else { |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function search($query) { |
223 | 223 | if (is_string($query)) { |
224 | - $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%' . $query . '%')); |
|
224 | + $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%'.$query.'%')); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // search is handled by a single query covering all caches that this folder contains |
@@ -265,22 +265,22 @@ discard block |
||
265 | 265 | $resultsPerCache = $searchHelper->searchInCaches($query, $caches); |
266 | 266 | |
267 | 267 | // loop through all results per-cache, constructing the FileInfo object from the CacheEntry and merge them all |
268 | - $files = array_merge(...array_map(function (array $results, $relativeMountPoint) use ($mountByMountPoint) { |
|
268 | + $files = array_merge(...array_map(function(array $results, $relativeMountPoint) use ($mountByMountPoint) { |
|
269 | 269 | $mount = $mountByMountPoint[$relativeMountPoint]; |
270 | - return array_map(function (ICacheEntry $result) use ($relativeMountPoint, $mount) { |
|
270 | + return array_map(function(ICacheEntry $result) use ($relativeMountPoint, $mount) { |
|
271 | 271 | return $this->cacheEntryToFileInfo($mount, $relativeMountPoint, $result); |
272 | 272 | }, $results); |
273 | 273 | }, array_values($resultsPerCache), array_keys($resultsPerCache))); |
274 | 274 | |
275 | 275 | // don't include this folder in the results |
276 | - $files = array_filter($files, function (FileInfo $file) { |
|
276 | + $files = array_filter($files, function(FileInfo $file) { |
|
277 | 277 | return $file->getPath() !== $this->getPath(); |
278 | 278 | }); |
279 | 279 | |
280 | 280 | // since results were returned per-cache, they are no longer fully sorted |
281 | 281 | $order = $query->getOrder(); |
282 | 282 | if ($order) { |
283 | - usort($files, function (FileInfo $a, FileInfo $b) use ($order) { |
|
283 | + usort($files, function(FileInfo $a, FileInfo $b) use ($order) { |
|
284 | 284 | foreach ($order as $orderField) { |
285 | 285 | $cmp = $orderField->sortFileInfo($a, $b); |
286 | 286 | if ($cmp !== 0) { |
@@ -291,16 +291,16 @@ discard block |
||
291 | 291 | }); |
292 | 292 | } |
293 | 293 | |
294 | - return array_map(function (FileInfo $file) { |
|
294 | + return array_map(function(FileInfo $file) { |
|
295 | 295 | return $this->createNode($file->getPath(), $file); |
296 | 296 | }, $files); |
297 | 297 | } |
298 | 298 | |
299 | 299 | private function cacheEntryToFileInfo(IMountPoint $mount, string $appendRoot, ICacheEntry $cacheEntry): FileInfo { |
300 | 300 | $cacheEntry['internalPath'] = $cacheEntry['path']; |
301 | - $cacheEntry['path'] = $appendRoot . $cacheEntry->getPath(); |
|
302 | - $subPath = $cacheEntry['path'] !== '' ? '/' . $cacheEntry['path'] : ''; |
|
303 | - return new \OC\Files\FileInfo($this->path . $subPath, $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount); |
|
301 | + $cacheEntry['path'] = $appendRoot.$cacheEntry->getPath(); |
|
302 | + $subPath = $cacheEntry['path'] !== '' ? '/'.$cacheEntry['path'] : ''; |
|
303 | + return new \OC\Files\FileInfo($this->path.$subPath, $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public function searchByMime($mimetype) { |
313 | 313 | if (strpos($mimetype, '/') === false) { |
314 | - $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%')); |
|
314 | + $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype.'/%')); |
|
315 | 315 | } else { |
316 | 316 | $query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', $mimetype)); |
317 | 317 | } |
@@ -335,12 +335,12 @@ discard block |
||
335 | 335 | * @return \OC\Files\Node\Node[] |
336 | 336 | */ |
337 | 337 | public function getById($id) { |
338 | - return $this->root->getByIdInPath((int)$id, $this->getPath()); |
|
338 | + return $this->root->getByIdInPath((int) $id, $this->getPath()); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | protected function getAppDataDirectoryName(): string { |
342 | 342 | $instanceId = \OC::$server->getConfig()->getSystemValueString('instanceid'); |
343 | - return 'appdata_' . $instanceId; |
|
343 | + return 'appdata_'.$instanceId; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -362,8 +362,8 @@ discard block |
||
362 | 362 | return []; |
363 | 363 | } |
364 | 364 | |
365 | - $absolutePath = '/' . ltrim($cacheEntry->getPath(), '/'); |
|
366 | - $currentPath = rtrim($this->path, '/') . '/'; |
|
365 | + $absolutePath = '/'.ltrim($cacheEntry->getPath(), '/'); |
|
366 | + $currentPath = rtrim($this->path, '/').'/'; |
|
367 | 367 | |
368 | 368 | if (strpos($absolutePath, $currentPath) !== 0) { |
369 | 369 | return []; |