@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | $this->share = $this->server->getShare(trim($params['share'], '/')); |
86 | 86 | |
87 | 87 | $this->root = $params['root'] ?? '/'; |
88 | - $this->root = '/' . ltrim($this->root, '/'); |
|
89 | - $this->root = rtrim($this->root, '/') . '/'; |
|
88 | + $this->root = '/'.ltrim($this->root, '/'); |
|
89 | + $this->root = rtrim($this->root, '/').'/'; |
|
90 | 90 | } else { |
91 | 91 | throw new \Exception('Invalid configuration'); |
92 | 92 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // FIXME: double slash to keep compatible with the old storage ids, |
102 | 102 | // failure to do so will lead to creation of a new storage id and |
103 | 103 | // loss of shares from the storage |
104 | - return 'smb::' . $this->server->getAuth()->getUsername() . '@' . $this->server->getHost() . '//' . $this->share->getName() . '/' . $this->root; |
|
104 | + return 'smb::'.$this->server->getAuth()->getUsername().'@'.$this->server->getHost().'//'.$this->share->getName().'/'.$this->root; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return string |
110 | 110 | */ |
111 | 111 | protected function buildPath($path) { |
112 | - return Filesystem::normalizePath($this->root . '/' . $path, true, false, true); |
|
112 | + return Filesystem::normalizePath($this->root.'/'.$path, true, false, true); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | protected function relativePath($fullPath) { |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | $path = $this->buildPath($path); |
150 | 150 | $files = $this->share->dir($path); |
151 | 151 | foreach ($files as $file) { |
152 | - $this->statCache[$path . '/' . $file->getName()] = $file; |
|
152 | + $this->statCache[$path.'/'.$file->getName()] = $file; |
|
153 | 153 | } |
154 | - return array_filter($files, function (IFileInfo $file) { |
|
154 | + return array_filter($files, function(IFileInfo $file) { |
|
155 | 155 | try { |
156 | 156 | return !$file->isHidden(); |
157 | 157 | } catch (ForbiddenException $e) { |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | case 'w': |
326 | 326 | case 'wb': |
327 | 327 | $source = $this->share->write($fullPath); |
328 | - return CallBackWrapper::wrap($source, null, null, function () use ($fullPath) { |
|
328 | + return CallBackWrapper::wrap($source, null, null, function() use ($fullPath) { |
|
329 | 329 | unset($this->statCache[$fullPath]); |
330 | 330 | }); |
331 | 331 | case 'a': |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | } |
358 | 358 | $source = fopen($tmpFile, $mode); |
359 | 359 | $share = $this->share; |
360 | - return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath, $share) { |
|
360 | + return CallbackWrapper::wrap($source, null, null, function() use ($tmpFile, $fullPath, $share) { |
|
361 | 361 | unset($this->statCache[$fullPath]); |
362 | 362 | $share->put($tmpFile, $fullPath); |
363 | 363 | unlink($tmpFile); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | $content = $this->share->dir($this->buildPath($path)); |
384 | 384 | foreach ($content as $file) { |
385 | 385 | if ($file->isDirectory()) { |
386 | - $this->rmdir($path . '/' . $file->getName()); |
|
386 | + $this->rmdir($path.'/'.$file->getName()); |
|
387 | 387 | } else { |
388 | 388 | $this->share->del($file->getPath()); |
389 | 389 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | } catch (ForbiddenException $e) { |
421 | 421 | return false; |
422 | 422 | } |
423 | - $names = array_map(function ($info) { |
|
423 | + $names = array_map(function($info) { |
|
424 | 424 | /** @var \Icewind\SMB\IFileInfo $info */ |
425 | 425 | return $info->getName(); |
426 | 426 | }, $files); |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | */ |
503 | 503 | public static function checkDependencies() { |
504 | 504 | return ( |
505 | - (bool)\OC_Helper::findBinaryPath('smbclient') |
|
505 | + (bool) \OC_Helper::findBinaryPath('smbclient') |
|
506 | 506 | || NativeServer::available(new System()) |
507 | 507 | ) ? true : ['smbclient']; |
508 | 508 | } |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | } |
522 | 522 | |
523 | 523 | public function listen($path, callable $callback) { |
524 | - $this->notify($path)->listen(function (IChange $change) use ($callback) { |
|
524 | + $this->notify($path)->listen(function(IChange $change) use ($callback) { |
|
525 | 525 | if ($change instanceof IRenameChange) { |
526 | 526 | return $callback($change->getType(), $change->getPath(), $change->getTargetPath()); |
527 | 527 | } else { |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | } |
532 | 532 | |
533 | 533 | public function notify($path) { |
534 | - $path = '/' . ltrim($path, '/'); |
|
534 | + $path = '/'.ltrim($path, '/'); |
|
535 | 535 | $shareNotifyHandler = $this->share->notify($this->buildPath($path)); |
536 | 536 | return new SMBNotifyHandler($shareNotifyHandler, $this->root); |
537 | 537 | } |