@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | $this->share = $this->server->getShare(trim($params['share'], '/')); |
111 | 111 | |
112 | 112 | $this->root = $params['root'] ?? '/'; |
113 | - $this->root = '/' . ltrim($this->root, '/'); |
|
114 | - $this->root = rtrim($this->root, '/') . '/'; |
|
113 | + $this->root = '/'.ltrim($this->root, '/'); |
|
114 | + $this->root = rtrim($this->root, '/').'/'; |
|
115 | 115 | |
116 | 116 | $this->showHidden = isset($params['show_hidden']) && $params['show_hidden']; |
117 | 117 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | // FIXME: double slash to keep compatible with the old storage ids, |
137 | 137 | // failure to do so will lead to creation of a new storage id and |
138 | 138 | // loss of shares from the storage |
139 | - return 'smb::' . $this->server->getAuth()->getUsername() . '@' . $this->server->getHost() . '//' . $this->share->getName() . '/' . $this->root; |
|
139 | + return 'smb::'.$this->server->getAuth()->getUsername().'@'.$this->server->getHost().'//'.$this->share->getName().'/'.$this->root; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @return string |
145 | 145 | */ |
146 | 146 | protected function buildPath($path) { |
147 | - return Filesystem::normalizePath($this->root . '/' . $path, true, false, true); |
|
147 | + return Filesystem::normalizePath($this->root.'/'.$path, true, false, true); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | protected function relativePath($fullPath) { |
@@ -185,22 +185,22 @@ discard block |
||
185 | 185 | $path = $this->buildPath($path); |
186 | 186 | $files = $this->share->dir($path); |
187 | 187 | foreach ($files as $file) { |
188 | - $this->statCache[$path . '/' . $file->getName()] = $file; |
|
188 | + $this->statCache[$path.'/'.$file->getName()] = $file; |
|
189 | 189 | } |
190 | - return array_filter($files, function (IFileInfo $file) { |
|
190 | + return array_filter($files, function(IFileInfo $file) { |
|
191 | 191 | try { |
192 | 192 | // the isHidden check is done before checking the config boolean to ensure that the metadata is always fetch |
193 | 193 | // so we trigger the below exceptions where applicable |
194 | 194 | $hide = $file->isHidden() && !$this->showHidden; |
195 | 195 | if ($hide) { |
196 | - $this->logger->debug('hiding hidden file ' . $file->getName()); |
|
196 | + $this->logger->debug('hiding hidden file '.$file->getName()); |
|
197 | 197 | } |
198 | 198 | return !$hide; |
199 | 199 | } catch (ForbiddenException $e) { |
200 | - $this->logger->logException($e, ['level' => ILogger::DEBUG, 'message' => 'Hiding forbidden entry ' . $file->getName()]); |
|
200 | + $this->logger->logException($e, ['level' => ILogger::DEBUG, 'message' => 'Hiding forbidden entry '.$file->getName()]); |
|
201 | 201 | return false; |
202 | 202 | } catch (NotFoundException $e) { |
203 | - $this->logger->logException($e, ['level' => ILogger::DEBUG, 'message' => 'Hiding not found entry ' . $file->getName()]); |
|
203 | + $this->logger->logException($e, ['level' => ILogger::DEBUG, 'message' => 'Hiding not found entry '.$file->getName()]); |
|
204 | 204 | return false; |
205 | 205 | } |
206 | 206 | }); |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | case 'w': |
391 | 391 | case 'wb': |
392 | 392 | $source = $this->share->write($fullPath); |
393 | - return CallBackWrapper::wrap($source, null, null, function () use ($fullPath) { |
|
393 | + return CallBackWrapper::wrap($source, null, null, function() use ($fullPath) { |
|
394 | 394 | unset($this->statCache[$fullPath]); |
395 | 395 | }); |
396 | 396 | case 'a': |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | } |
423 | 423 | $source = fopen($tmpFile, $mode); |
424 | 424 | $share = $this->share; |
425 | - return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath, $share) { |
|
425 | + return CallbackWrapper::wrap($source, null, null, function() use ($tmpFile, $fullPath, $share) { |
|
426 | 426 | unset($this->statCache[$fullPath]); |
427 | 427 | $share->put($tmpFile, $fullPath); |
428 | 428 | unlink($tmpFile); |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | $content = $this->share->dir($this->buildPath($path)); |
450 | 450 | foreach ($content as $file) { |
451 | 451 | if ($file->isDirectory()) { |
452 | - $this->rmdir($path . '/' . $file->getName()); |
|
452 | + $this->rmdir($path.'/'.$file->getName()); |
|
453 | 453 | } else { |
454 | 454 | $this->share->del($file->getPath()); |
455 | 455 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | } catch (ForbiddenException $e) { |
489 | 489 | return false; |
490 | 490 | } |
491 | - $names = array_map(function ($info) { |
|
491 | + $names = array_map(function($info) { |
|
492 | 492 | /** @var \Icewind\SMB\IFileInfo $info */ |
493 | 493 | return $info->getName(); |
494 | 494 | }, $files); |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | */ |
572 | 572 | public static function checkDependencies() { |
573 | 573 | return ( |
574 | - (bool)\OC_Helper::findBinaryPath('smbclient') |
|
574 | + (bool) \OC_Helper::findBinaryPath('smbclient') |
|
575 | 575 | || NativeServer::available(new System()) |
576 | 576 | ) ? true : ['smbclient']; |
577 | 577 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | } |
592 | 592 | |
593 | 593 | public function listen($path, callable $callback) { |
594 | - $this->notify($path)->listen(function (IChange $change) use ($callback) { |
|
594 | + $this->notify($path)->listen(function(IChange $change) use ($callback) { |
|
595 | 595 | if ($change instanceof IRenameChange) { |
596 | 596 | return $callback($change->getType(), $change->getPath(), $change->getTargetPath()); |
597 | 597 | } else { |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | } |
602 | 602 | |
603 | 603 | public function notify($path) { |
604 | - $path = '/' . ltrim($path, '/'); |
|
604 | + $path = '/'.ltrim($path, '/'); |
|
605 | 605 | $shareNotifyHandler = $this->share->notify($this->buildPath($path)); |
606 | 606 | return new SMBNotifyHandler($shareNotifyHandler, $this->root); |
607 | 607 | } |