@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $options = new Options(); |
| 121 | 121 | if (isset($params['timeout'])) { |
| 122 | - $timeout = (int)$params['timeout']; |
|
| 122 | + $timeout = (int) $params['timeout']; |
|
| 123 | 123 | if ($timeout > 0) { |
| 124 | 124 | $options->setTimeout($timeout); |
| 125 | 125 | } |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | $this->share = $this->server->getShare(trim($params['share'], '/')); |
| 130 | 130 | |
| 131 | 131 | $this->root = $params['root'] ?? '/'; |
| 132 | - $this->root = '/' . ltrim($this->root, '/'); |
|
| 133 | - $this->root = rtrim($this->root, '/') . '/'; |
|
| 132 | + $this->root = '/'.ltrim($this->root, '/'); |
|
| 133 | + $this->root = rtrim($this->root, '/').'/'; |
|
| 134 | 134 | |
| 135 | 135 | $this->showHidden = isset($params['show_hidden']) && $params['show_hidden']; |
| 136 | 136 | $this->checkAcl = isset($params['check_acl']) && $params['check_acl']; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | // FIXME: double slash to keep compatible with the old storage ids, |
| 157 | 157 | // failure to do so will lead to creation of a new storage id and |
| 158 | 158 | // loss of shares from the storage |
| 159 | - return 'smb::' . $this->server->getAuth()->getUsername() . '@' . $this->server->getHost() . '//' . $this->share->getName() . '/' . $this->root; |
|
| 159 | + return 'smb::'.$this->server->getAuth()->getUsername().'@'.$this->server->getHost().'//'.$this->share->getName().'/'.$this->root; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @return string |
| 165 | 165 | */ |
| 166 | 166 | protected function buildPath($path) { |
| 167 | - return Filesystem::normalizePath($this->root . '/' . $path, true, false, true); |
|
| 167 | + return Filesystem::normalizePath($this->root.'/'.$path, true, false, true); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | protected function relativePath($fullPath) { |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | throw new NotPermittedException(); |
| 243 | 243 | } |
| 244 | 244 | foreach ($files as $file) { |
| 245 | - $this->statCache[$path . '/' . $file->getName()] = $file; |
|
| 245 | + $this->statCache[$path.'/'.$file->getName()] = $file; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | foreach ($files as $file) { |
@@ -256,21 +256,21 @@ discard block |
||
| 256 | 256 | // this doesn't take inheritance fully into account but if read permissions is denied for a parent we wouldn't be in this folder |
| 257 | 257 | // additionally, it's better to have false negatives here then false positives |
| 258 | 258 | if ($acl->denies(ACL::MASK_READ) || $acl->denies(ACL::MASK_EXECUTE)) { |
| 259 | - $this->logger->debug('Hiding non readable entry ' . $file->getName()); |
|
| 259 | + $this->logger->debug('Hiding non readable entry '.$file->getName()); |
|
| 260 | 260 | return false; |
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | if ($hide) { |
| 265 | - $this->logger->debug('hiding hidden file ' . $file->getName()); |
|
| 265 | + $this->logger->debug('hiding hidden file '.$file->getName()); |
|
| 266 | 266 | } |
| 267 | 267 | if (!$hide) { |
| 268 | 268 | yield $file; |
| 269 | 269 | } |
| 270 | 270 | } catch (ForbiddenException $e) { |
| 271 | - $this->logger->logException($e, ['level' => ILogger::DEBUG, 'message' => 'Hiding forbidden entry ' . $file->getName()]); |
|
| 271 | + $this->logger->logException($e, ['level' => ILogger::DEBUG, 'message' => 'Hiding forbidden entry '.$file->getName()]); |
|
| 272 | 272 | } catch (NotFoundException $e) { |
| 273 | - $this->logger->logException($e, ['level' => ILogger::DEBUG, 'message' => 'Hiding not found entry ' . $file->getName()]); |
|
| 273 | + $this->logger->logException($e, ['level' => ILogger::DEBUG, 'message' => 'Hiding not found entry '.$file->getName()]); |
|
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | } catch (ConnectException $e) { |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | case 'w': |
| 462 | 462 | case 'wb': |
| 463 | 463 | $source = $this->share->write($fullPath); |
| 464 | - return CallBackWrapper::wrap($source, null, null, function () use ($fullPath) { |
|
| 464 | + return CallBackWrapper::wrap($source, null, null, function() use ($fullPath) { |
|
| 465 | 465 | unset($this->statCache[$fullPath]); |
| 466 | 466 | }); |
| 467 | 467 | case 'a': |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | } |
| 494 | 494 | $source = fopen($tmpFile, $mode); |
| 495 | 495 | $share = $this->share; |
| 496 | - return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath, $share) { |
|
| 496 | + return CallbackWrapper::wrap($source, null, null, function() use ($tmpFile, $fullPath, $share) { |
|
| 497 | 497 | unset($this->statCache[$fullPath]); |
| 498 | 498 | $share->put($tmpFile, $fullPath); |
| 499 | 499 | unlink($tmpFile); |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | $content = $this->share->dir($this->buildPath($path)); |
| 523 | 523 | foreach ($content as $file) { |
| 524 | 524 | if ($file->isDirectory()) { |
| 525 | - $this->rmdir($path . '/' . $file->getName()); |
|
| 525 | + $this->rmdir($path.'/'.$file->getName()); |
|
| 526 | 526 | } else { |
| 527 | 527 | $this->share->del($file->getPath()); |
| 528 | 528 | } |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | } catch (NotPermittedException $e) { |
| 604 | 604 | return false; |
| 605 | 605 | } |
| 606 | - $names = array_map(function ($info) { |
|
| 606 | + $names = array_map(function($info) { |
|
| 607 | 607 | /** @var \Icewind\SMB\IFileInfo $info */ |
| 608 | 608 | return $info->getName(); |
| 609 | 609 | }, iterator_to_array($files)); |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | */ |
| 694 | 694 | public static function checkDependencies() { |
| 695 | 695 | return ( |
| 696 | - (bool)\OC_Helper::findBinaryPath('smbclient') |
|
| 696 | + (bool) \OC_Helper::findBinaryPath('smbclient') |
|
| 697 | 697 | || NativeServer::available(new System()) |
| 698 | 698 | ) ? true : ['smbclient']; |
| 699 | 699 | } |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | public function listen($path, callable $callback) { |
| 716 | - $this->notify($path)->listen(function (IChange $change) use ($callback) { |
|
| 716 | + $this->notify($path)->listen(function(IChange $change) use ($callback) { |
|
| 717 | 717 | if ($change instanceof IRenameChange) { |
| 718 | 718 | return $callback($change->getType(), $change->getPath(), $change->getTargetPath()); |
| 719 | 719 | } else { |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | } |
| 724 | 724 | |
| 725 | 725 | public function notify($path) { |
| 726 | - $path = '/' . ltrim($path, '/'); |
|
| 726 | + $path = '/'.ltrim($path, '/'); |
|
| 727 | 727 | $shareNotifyHandler = $this->share->notify($this->buildPath($path)); |
| 728 | 728 | return new SMBNotifyHandler($shareNotifyHandler, $this->root); |
| 729 | 729 | } |