@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | $this->share = $this->server->getShare(trim($params['share'], '/')); |
| 87 | 87 | |
| 88 | 88 | $this->root = $params['root'] ?? '/'; |
| 89 | - $this->root = '/' . ltrim($this->root, '/'); |
|
| 90 | - $this->root = rtrim($this->root, '/') . '/'; |
|
| 89 | + $this->root = '/'.ltrim($this->root, '/'); |
|
| 90 | + $this->root = rtrim($this->root, '/').'/'; |
|
| 91 | 91 | } else { |
| 92 | - throw new \Exception('Invalid configuration: ' . json_encode($params)); |
|
| 92 | + throw new \Exception('Invalid configuration: '.json_encode($params)); |
|
| 93 | 93 | } |
| 94 | 94 | $this->statCache = new CappedMemoryCache(); |
| 95 | 95 | parent::__construct($params); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | // FIXME: double slash to keep compatible with the old storage ids, |
| 113 | 113 | // failure to do so will lead to creation of a new storage id and |
| 114 | 114 | // loss of shares from the storage |
| 115 | - return 'smb::' . $this->server->getAuth()->getUsername() . '@' . $this->server->getHost() . '//' . $this->share->getName() . '/' . $this->root; |
|
| 115 | + return 'smb::'.$this->server->getAuth()->getUsername().'@'.$this->server->getHost().'//'.$this->share->getName().'/'.$this->root; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * @return string |
| 121 | 121 | */ |
| 122 | 122 | protected function buildPath($path) { |
| 123 | - return Filesystem::normalizePath($this->root . '/' . $path, true, false, true); |
|
| 123 | + return Filesystem::normalizePath($this->root.'/'.$path, true, false, true); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | protected function relativePath($fullPath) { |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | $path = $this->buildPath($path); |
| 161 | 161 | $files = $this->share->dir($path); |
| 162 | 162 | foreach ($files as $file) { |
| 163 | - $this->statCache[$path . '/' . $file->getName()] = $file; |
|
| 163 | + $this->statCache[$path.'/'.$file->getName()] = $file; |
|
| 164 | 164 | } |
| 165 | - return array_filter($files, function (IFileInfo $file) { |
|
| 165 | + return array_filter($files, function(IFileInfo $file) { |
|
| 166 | 166 | try { |
| 167 | 167 | return !$file->isHidden(); |
| 168 | 168 | } catch (ForbiddenException $e) { |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | case 'w': |
| 337 | 337 | case 'wb': |
| 338 | 338 | $source = $this->share->write($fullPath); |
| 339 | - return CallBackWrapper::wrap($source, null, null, function () use ($fullPath) { |
|
| 339 | + return CallBackWrapper::wrap($source, null, null, function() use ($fullPath) { |
|
| 340 | 340 | unset($this->statCache[$fullPath]); |
| 341 | 341 | }); |
| 342 | 342 | case 'a': |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | } |
| 369 | 369 | $source = fopen($tmpFile, $mode); |
| 370 | 370 | $share = $this->share; |
| 371 | - return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath, $share) { |
|
| 371 | + return CallbackWrapper::wrap($source, null, null, function() use ($tmpFile, $fullPath, $share) { |
|
| 372 | 372 | unset($this->statCache[$fullPath]); |
| 373 | 373 | $share->put($tmpFile, $fullPath); |
| 374 | 374 | unlink($tmpFile); |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | $content = $this->share->dir($this->buildPath($path)); |
| 395 | 395 | foreach ($content as $file) { |
| 396 | 396 | if ($file->isDirectory()) { |
| 397 | - $this->rmdir($path . '/' . $file->getName()); |
|
| 397 | + $this->rmdir($path.'/'.$file->getName()); |
|
| 398 | 398 | } else { |
| 399 | 399 | $this->share->del($file->getPath()); |
| 400 | 400 | } |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | } catch (ForbiddenException $e) { |
| 432 | 432 | return false; |
| 433 | 433 | } |
| 434 | - $names = array_map(function ($info) { |
|
| 434 | + $names = array_map(function($info) { |
|
| 435 | 435 | /** @var \Icewind\SMB\IFileInfo $info */ |
| 436 | 436 | return $info->getName(); |
| 437 | 437 | }, $files); |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | */ |
| 514 | 514 | public static function checkDependencies() { |
| 515 | 515 | return ( |
| 516 | - (bool)\OC_Helper::findBinaryPath('smbclient') |
|
| 516 | + (bool) \OC_Helper::findBinaryPath('smbclient') |
|
| 517 | 517 | || NativeServer::available(new System()) |
| 518 | 518 | ) ? true : ['smbclient']; |
| 519 | 519 | } |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | public function listen($path, callable $callback) { |
| 535 | - $this->notify($path)->listen(function (IChange $change) use ($callback) { |
|
| 535 | + $this->notify($path)->listen(function(IChange $change) use ($callback) { |
|
| 536 | 536 | if ($change instanceof IRenameChange) { |
| 537 | 537 | return $callback($change->getType(), $change->getPath(), $change->getTargetPath()); |
| 538 | 538 | } else { |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | public function notify($path) { |
| 545 | - $path = '/' . ltrim($path, '/'); |
|
| 545 | + $path = '/'.ltrim($path, '/'); |
|
| 546 | 546 | $shareNotifyHandler = $this->share->notify($this->buildPath($path)); |
| 547 | 547 | return new SMBNotifyHandler($shareNotifyHandler, $this->root); |
| 548 | 548 | } |