Completed
Push — master ( 9cf11b...1c13e7 )
by Morris
88:12 queued 65:56
created
apps/files_external/lib/Lib/Storage/SMB.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 		$this->share = $this->server->getShare(trim($params['share'], '/'));
107 107
 
108 108
 		$this->root = $params['root'] ?? '/';
109
-		$this->root = '/' . ltrim($this->root, '/');
110
-		$this->root = rtrim($this->root, '/') . '/';
109
+		$this->root = '/'.ltrim($this->root, '/');
110
+		$this->root = rtrim($this->root, '/').'/';
111 111
 
112 112
 		$this->statCache = new CappedMemoryCache();
113 113
 		parent::__construct($params);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		// FIXME: double slash to keep compatible with the old storage ids,
131 131
 		// failure to do so will lead to creation of a new storage id and
132 132
 		// loss of shares from the storage
133
-		return 'smb::' . $this->server->getAuth()->getUsername() . '@' . $this->server->getHost() . '//' . $this->share->getName() . '/' . $this->root;
133
+		return 'smb::'.$this->server->getAuth()->getUsername().'@'.$this->server->getHost().'//'.$this->share->getName().'/'.$this->root;
134 134
 	}
135 135
 
136 136
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @return string
139 139
 	 */
140 140
 	protected function buildPath($path) {
141
-		return Filesystem::normalizePath($this->root . '/' . $path, true, false, true);
141
+		return Filesystem::normalizePath($this->root.'/'.$path, true, false, true);
142 142
 	}
143 143
 
144 144
 	protected function relativePath($fullPath) {
@@ -179,19 +179,19 @@  discard block
 block discarded – undo
179 179
 			$path = $this->buildPath($path);
180 180
 			$files = $this->share->dir($path);
181 181
 			foreach ($files as $file) {
182
-				$this->statCache[$path . '/' . $file->getName()] = $file;
182
+				$this->statCache[$path.'/'.$file->getName()] = $file;
183 183
 			}
184
-			return array_filter($files, function (IFileInfo $file) {
184
+			return array_filter($files, function(IFileInfo $file) {
185 185
 				try {
186 186
 					if ($file->isHidden()) {
187
-						$this->logger->debug('hiding hidden file ' . $file->getName());
187
+						$this->logger->debug('hiding hidden file '.$file->getName());
188 188
 					}
189 189
 					return !$file->isHidden();
190 190
 				} catch (ForbiddenException $e) {
191
-					$this->logger->logException($e, ['level' => ILogger::DEBUG, 'message' => 'Hiding forbidden entry ' . $file->getName()]);
191
+					$this->logger->logException($e, ['level' => ILogger::DEBUG, 'message' => 'Hiding forbidden entry '.$file->getName()]);
192 192
 					return false;
193 193
 				} catch (NotFoundException $e) {
194
-					$this->logger->logException($e, ['level' => ILogger::DEBUG, 'message' => 'Hiding not found entry ' . $file->getName()]);
194
+					$this->logger->logException($e, ['level' => ILogger::DEBUG, 'message' => 'Hiding not found entry '.$file->getName()]);
195 195
 					return false;
196 196
 				}
197 197
 			});
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 				case 'w':
376 376
 				case 'wb':
377 377
 					$source = $this->share->write($fullPath);
378
-					return CallBackWrapper::wrap($source, null, null, function () use ($fullPath) {
378
+					return CallBackWrapper::wrap($source, null, null, function() use ($fullPath) {
379 379
 						unset($this->statCache[$fullPath]);
380 380
 					});
381 381
 				case 'a':
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 					}
408 408
 					$source = fopen($tmpFile, $mode);
409 409
 					$share = $this->share;
410
-					return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath, $share) {
410
+					return CallbackWrapper::wrap($source, null, null, function() use ($tmpFile, $fullPath, $share) {
411 411
 						unset($this->statCache[$fullPath]);
412 412
 						$share->put($tmpFile, $fullPath);
413 413
 						unlink($tmpFile);
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 			$content = $this->share->dir($this->buildPath($path));
435 435
 			foreach ($content as $file) {
436 436
 				if ($file->isDirectory()) {
437
-					$this->rmdir($path . '/' . $file->getName());
437
+					$this->rmdir($path.'/'.$file->getName());
438 438
 				} else {
439 439
 					$this->share->del($file->getPath());
440 440
 				}
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 		} catch (ForbiddenException $e) {
474 474
 			return false;
475 475
 		}
476
-		$names = array_map(function ($info) {
476
+		$names = array_map(function($info) {
477 477
 			/** @var \Icewind\SMB\IFileInfo $info */
478 478
 			return $info->getName();
479 479
 		}, $files);
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 	 */
557 557
 	public static function checkDependencies() {
558 558
 		return (
559
-			(bool)\OC_Helper::findBinaryPath('smbclient')
559
+			(bool) \OC_Helper::findBinaryPath('smbclient')
560 560
 			|| NativeServer::available(new System())
561 561
 		) ? true : ['smbclient'];
562 562
 	}
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	}
577 577
 
578 578
 	public function listen($path, callable $callback) {
579
-		$this->notify($path)->listen(function (IChange $change) use ($callback) {
579
+		$this->notify($path)->listen(function(IChange $change) use ($callback) {
580 580
 			if ($change instanceof IRenameChange) {
581 581
 				return $callback($change->getType(), $change->getPath(), $change->getTargetPath());
582 582
 			} else {
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 	}
587 587
 
588 588
 	public function notify($path) {
589
-		$path = '/' . ltrim($path, '/');
589
+		$path = '/'.ltrim($path, '/');
590 590
 		$shareNotifyHandler = $this->share->notify($this->buildPath($path));
591 591
 		return new SMBNotifyHandler($shareNotifyHandler, $this->root);
592 592
 	}
Please login to merge, or discard this patch.