@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | $this->share = $this->server->getShare(trim($params['share'], '/')); |
| 96 | 96 | |
| 97 | 97 | $this->root = $params['root'] ?? '/'; |
| 98 | - $this->root = '/' . ltrim($this->root, '/'); |
|
| 99 | - $this->root = rtrim($this->root, '/') . '/'; |
|
| 98 | + $this->root = '/'.ltrim($this->root, '/'); |
|
| 99 | + $this->root = rtrim($this->root, '/').'/'; |
|
| 100 | 100 | |
| 101 | 101 | $this->statCache = new CappedMemoryCache(); |
| 102 | 102 | parent::__construct($params); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | // FIXME: double slash to keep compatible with the old storage ids, |
| 110 | 110 | // failure to do so will lead to creation of a new storage id and |
| 111 | 111 | // loss of shares from the storage |
| 112 | - return 'smb::' . $this->server->getAuth()->getUsername() . '@' . $this->server->getHost() . '//' . $this->share->getName() . '/' . $this->root; |
|
| 112 | + return 'smb::'.$this->server->getAuth()->getUsername().'@'.$this->server->getHost().'//'.$this->share->getName().'/'.$this->root; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @return string |
| 118 | 118 | */ |
| 119 | 119 | protected function buildPath($path) { |
| 120 | - return Filesystem::normalizePath($this->root . '/' . $path, true, false, true); |
|
| 120 | + return Filesystem::normalizePath($this->root.'/'.$path, true, false, true); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | protected function relativePath($fullPath) { |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | $path = $this->buildPath($path); |
| 158 | 158 | $files = $this->share->dir($path); |
| 159 | 159 | foreach ($files as $file) { |
| 160 | - $this->statCache[$path . '/' . $file->getName()] = $file; |
|
| 160 | + $this->statCache[$path.'/'.$file->getName()] = $file; |
|
| 161 | 161 | } |
| 162 | - return array_filter($files, function (IFileInfo $file) { |
|
| 162 | + return array_filter($files, function(IFileInfo $file) { |
|
| 163 | 163 | try { |
| 164 | 164 | return !$file->isHidden(); |
| 165 | 165 | } catch (ForbiddenException $e) { |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | case 'w': |
| 334 | 334 | case 'wb': |
| 335 | 335 | $source = $this->share->write($fullPath); |
| 336 | - return CallBackWrapper::wrap($source, null, null, function () use ($fullPath) { |
|
| 336 | + return CallBackWrapper::wrap($source, null, null, function() use ($fullPath) { |
|
| 337 | 337 | unset($this->statCache[$fullPath]); |
| 338 | 338 | }); |
| 339 | 339 | case 'a': |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | $source = fopen($tmpFile, $mode); |
| 367 | 367 | $share = $this->share; |
| 368 | - return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath, $share) { |
|
| 368 | + return CallbackWrapper::wrap($source, null, null, function() use ($tmpFile, $fullPath, $share) { |
|
| 369 | 369 | unset($this->statCache[$fullPath]); |
| 370 | 370 | $share->put($tmpFile, $fullPath); |
| 371 | 371 | unlink($tmpFile); |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $content = $this->share->dir($this->buildPath($path)); |
| 392 | 392 | foreach ($content as $file) { |
| 393 | 393 | if ($file->isDirectory()) { |
| 394 | - $this->rmdir($path . '/' . $file->getName()); |
|
| 394 | + $this->rmdir($path.'/'.$file->getName()); |
|
| 395 | 395 | } else { |
| 396 | 396 | $this->share->del($file->getPath()); |
| 397 | 397 | } |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | } catch (ForbiddenException $e) { |
| 429 | 429 | return false; |
| 430 | 430 | } |
| 431 | - $names = array_map(function ($info) { |
|
| 431 | + $names = array_map(function($info) { |
|
| 432 | 432 | /** @var \Icewind\SMB\IFileInfo $info */ |
| 433 | 433 | return $info->getName(); |
| 434 | 434 | }, $files); |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | */ |
| 511 | 511 | public static function checkDependencies() { |
| 512 | 512 | return ( |
| 513 | - (bool)\OC_Helper::findBinaryPath('smbclient') |
|
| 513 | + (bool) \OC_Helper::findBinaryPath('smbclient') |
|
| 514 | 514 | || NativeServer::available(new System()) |
| 515 | 515 | ) ? true : ['smbclient']; |
| 516 | 516 | } |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | public function listen($path, callable $callback) { |
| 532 | - $this->notify($path)->listen(function (IChange $change) use ($callback) { |
|
| 532 | + $this->notify($path)->listen(function(IChange $change) use ($callback) { |
|
| 533 | 533 | if ($change instanceof IRenameChange) { |
| 534 | 534 | return $callback($change->getType(), $change->getPath(), $change->getTargetPath()); |
| 535 | 535 | } else { |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | public function notify($path) { |
| 542 | - $path = '/' . ltrim($path, '/'); |
|
| 542 | + $path = '/'.ltrim($path, '/'); |
|
| 543 | 543 | $shareNotifyHandler = $this->share->notify($this->buildPath($path)); |
| 544 | 544 | return new SMBNotifyHandler($shareNotifyHandler, $this->root); |
| 545 | 545 | } |