Passed
Push — master ( 7e3600...e3822e )
by Blizzz
36:19 queued 20:27
created
apps/files_external/lib/Lib/Storage/AmazonS3.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	public function __construct($parameters) {
84 84
 		parent::__construct($parameters);
85 85
 		$this->parseParams($parameters);
86
-		$this->id = 'amazon::external::' . md5($this->params['hostname'] . ':' . $this->params['bucket'] . ':' . $this->params['key']);
86
+		$this->id = 'amazon::external::'.md5($this->params['hostname'].':'.$this->params['bucket'].':'.$this->params['key']);
87 87
 		$this->objectCache = new CappedMemoryCache();
88 88
 		$this->directoryCache = new CappedMemoryCache();
89 89
 		$this->filesCache = new CappedMemoryCache();
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		if ($path === '.' || $path === '') {
188 188
 			return true;
189 189
 		}
190
-		$path = rtrim($path, '/') . '/';
190
+		$path = rtrim($path, '/').'/';
191 191
 
192 192
 		if (isset($this->directoryCache[$path])) {
193 193
 			return $this->directoryCache[$path];
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 		try {
254 254
 			$this->getConnection()->putObject([
255 255
 				'Bucket' => $this->bucket,
256
-				'Key' => $path . '/',
256
+				'Key' => $path.'/',
257 257
 				'Body' => '',
258 258
 				'ContentType' => FileInfo::MIMETYPE_FOLDER
259 259
 			]);
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 			'Bucket' => $this->bucket
303 303
 		];
304 304
 		if ($path !== null) {
305
-			$params['Prefix'] = $path . '/';
305
+			$params['Prefix'] = $path.'/';
306 306
 		}
307 307
 		try {
308 308
 			$connection = $this->getConnection();
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	public function opendir($path) {
340 340
 		try {
341 341
 			$content = iterator_to_array($this->getDirectoryContent($path));
342
-			return IteratorDirectory::wrap(array_map(function (array $item) {
342
+			return IteratorDirectory::wrap(array_map(function(array $item) {
343 343
 				return $item['name'];
344 344
 			}, $content));
345 345
 		} catch (S3Exception $e) {
@@ -375,12 +375,12 @@  discard block
 block discarded – undo
375 375
 	 */
376 376
 	private function getContentLength($path) {
377 377
 		if (isset($this->filesCache[$path])) {
378
-			return (int)$this->filesCache[$path]['ContentLength'];
378
+			return (int) $this->filesCache[$path]['ContentLength'];
379 379
 		}
380 380
 
381 381
 		$result = $this->headObject($path);
382 382
 		if (isset($result['ContentLength'])) {
383
-			return (int)$result['ContentLength'];
383
+			return (int) $result['ContentLength'];
384 384
 		}
385 385
 
386 386
 		return 0;
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 				$tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
510 510
 
511 511
 				$handle = fopen($tmpFile, 'w');
512
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
512
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
513 513
 					$this->writeBack($tmpFile, $path);
514 514
 				});
515 515
 			case 'a':
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 				}
535 535
 
536 536
 				$handle = fopen($tmpFile, $mode);
537
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
537
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
538 538
 					$this->writeBack($tmpFile, $path);
539 539
 				});
540 540
 		}
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 				$this->getConnection()->copyObject([
584 584
 					'Bucket' => $this->bucket,
585 585
 					'Key' => $this->cleanKey($target),
586
-					'CopySource' => S3Client::encodeKey($this->bucket . '/' . $source)
586
+					'CopySource' => S3Client::encodeKey($this->bucket.'/'.$source)
587 587
 				]);
588 588
 				$this->testTimeout();
589 589
 			} catch (S3Exception $e) {
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
 			}
609 609
 
610 610
 			foreach ($this->getDirectoryContent($source) as $item) {
611
-				$childSource = $source . '/' . $item['name'];
612
-				$childTarget = $target . '/' . $item['name'];
611
+				$childSource = $source.'/'.$item['name'];
612
+				$childTarget = $target.'/'.$item['name'];
613 613
 				$this->copy($childSource, $childTarget, $item['mimetype'] !== FileInfo::MIMETYPE_FOLDER);
614 614
 			}
615 615
 		}
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 			'storage_mtime' => strtotime($object['LastModified']),
726 726
 			'etag' => $object['ETag'],
727 727
 			'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE,
728
-			'size' => (int)($object['Size'] ?? $object['ContentLength']),
728
+			'size' => (int) ($object['Size'] ?? $object['ContentLength']),
729 729
 		];
730 730
 	}
731 731
 
@@ -754,10 +754,10 @@  discard block
 block discarded – undo
754 754
 
755 755
 	public function versioningEnabled(): bool {
756 756
 		if ($this->versioningEnabled === null) {
757
-			$cached = $this->memCache->get('versioning-enabled::' . $this->getBucket());
757
+			$cached = $this->memCache->get('versioning-enabled::'.$this->getBucket());
758 758
 			if ($cached === null) {
759 759
 				$this->versioningEnabled = $this->getVersioningStatusFromBucket();
760
-				$this->memCache->set('versioning-enabled::' . $this->getBucket(), $this->versioningEnabled, 60);
760
+				$this->memCache->set('versioning-enabled::'.$this->getBucket(), $this->versioningEnabled, 60);
761 761
 			} else {
762 762
 				$this->versioningEnabled = $cached;
763 763
 			}
Please login to merge, or discard this patch.