Passed
Push — master ( b3f59a...eecd46 )
by Julius
16:28 queued 12s
created
lib/private/Files/ObjectStore/ObjectStoreStorage.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
 			throw new \Exception('missing IObjectStore instance');
78 78
 		}
79 79
 		if (isset($params['storageid'])) {
80
-			$this->id = 'object::store:' . $params['storageid'];
80
+			$this->id = 'object::store:'.$params['storageid'];
81 81
 		} else {
82
-			$this->id = 'object::store:' . $this->objectStore->getStorageId();
82
+			$this->id = 'object::store:'.$this->objectStore->getStorageId();
83 83
 		}
84 84
 		if (isset($params['objectPrefix'])) {
85 85
 			$this->objectPrefix = $params['objectPrefix'];
86 86
 		}
87 87
 		if (isset($params['validateWrites'])) {
88
-			$this->validateWrites = (bool)$params['validateWrites'];
88
+			$this->validateWrites = (bool) $params['validateWrites'];
89 89
 		}
90 90
 		//initialize cache with root directory in cache
91 91
 		if (!$this->is_dir('/')) {
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			if ($ex->getCode() !== 404) {
228 228
 				$this->logger->logException($ex, [
229 229
 					'app' => 'objectstore',
230
-					'message' => 'Could not delete object ' . $this->getURN($entry->getId()) . ' for ' . $entry->getPath(),
230
+					'message' => 'Could not delete object '.$this->getURN($entry->getId()).' for '.$entry->getPath(),
231 231
 				]);
232 232
 				return false;
233 233
 			}
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	public function getURN($fileId) {
269 269
 		if (is_numeric($fileId)) {
270
-			return $this->objectPrefix . $fileId;
270
+			return $this->objectPrefix.$fileId;
271 271
 		}
272 272
 		return null;
273 273
 	}
@@ -330,19 +330,19 @@  discard block
 block discarded – undo
330 330
 						$streamStat = fstat($handle);
331 331
 						$actualSize = $streamStat['size'] ?? -1;
332 332
 						if ($actualSize > -1 && $actualSize !== $filesize) {
333
-							$this->getCache()->update((int)$stat['fileid'], ['size' => $actualSize]);
333
+							$this->getCache()->update((int) $stat['fileid'], ['size' => $actualSize]);
334 334
 						}
335 335
 						return $handle;
336 336
 					} catch (NotFoundException $e) {
337 337
 						$this->logger->logException($e, [
338 338
 							'app' => 'objectstore',
339
-							'message' => 'Could not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path,
339
+							'message' => 'Could not get object '.$this->getURN($stat['fileid']).' for file '.$path,
340 340
 						]);
341 341
 						throw $e;
342 342
 					} catch (\Exception $ex) {
343 343
 						$this->logger->logException($ex, [
344 344
 							'app' => 'objectstore',
345
-							'message' => 'Could not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path,
345
+							'message' => 'Could not get object '.$this->getURN($stat['fileid']).' for file '.$path,
346 346
 						]);
347 347
 						return false;
348 348
 					}
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 			case 'wb+':
357 357
 				$tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
358 358
 				$handle = fopen($tmpFile, $mode);
359
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
359
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
360 360
 					$this->writeBack($tmpFile, $path);
361 361
 					unlink($tmpFile);
362 362
 				});
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 					file_put_contents($tmpFile, $source);
375 375
 				}
376 376
 				$handle = fopen($tmpFile, $mode);
377
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
377
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
378 378
 					$this->writeBack($tmpFile, $path);
379 379
 					unlink($tmpFile);
380 380
 				});
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
 	public function file_exists($path) {
386 386
 		$path = $this->normalizePath($path);
387
-		return (bool)$this->stat($path);
387
+		return (bool) $this->stat($path);
388 388
 	}
389 389
 
390 390
 	public function rename($source, $target) {
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 			} catch (\Exception $ex) {
437 437
 				$this->logger->logException($ex, [
438 438
 					'app' => 'objectstore',
439
-					'message' => 'Could not create object for ' . $path,
439
+					'message' => 'Could not create object for '.$path,
440 440
 				]);
441 441
 				throw $ex;
442 442
 			}
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 		}
482 482
 		// update stat with new data
483 483
 		$mTime = time();
484
-		$stat['size'] = (int)$size;
484
+		$stat['size'] = (int) $size;
485 485
 		$stat['mtime'] = $mTime;
486 486
 		$stat['storage_mtime'] = $mTime;
487 487
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 		$stat['checksum'] = '';
494 494
 
495 495
 		$exists = $this->getCache()->inCache($path);
496
-		$uploadPath = $exists ? $path : $path . '.part';
496
+		$uploadPath = $exists ? $path : $path.'.part';
497 497
 
498 498
 		if ($exists) {
499 499
 			$fileId = $stat['fileid'];
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 		try {
506 506
 			//upload to object storage
507 507
 			if ($size === null) {
508
-				$countStream = CountWrapper::wrap($stream, function ($writtenSize) use ($fileId, &$size) {
508
+				$countStream = CountWrapper::wrap($stream, function($writtenSize) use ($fileId, &$size) {
509 509
 					$this->getCache()->update($fileId, [
510 510
 						'size' => $writtenSize,
511 511
 					]);
@@ -531,12 +531,12 @@  discard block
 block discarded – undo
531 531
 				$this->getCache()->remove($uploadPath);
532 532
 				$this->logger->logException($ex, [
533 533
 					'app' => 'objectstore',
534
-					'message' => 'Could not create object ' . $urn . ' for ' . $path,
534
+					'message' => 'Could not create object '.$urn.' for '.$path,
535 535
 				]);
536 536
 			} else {
537 537
 				$this->logger->logException($ex, [
538 538
 					'app' => 'objectstore',
539
-					'message' => 'Could not update object ' . $urn . ' for ' . $path,
539
+					'message' => 'Could not update object '.$urn.' for '.$path,
540 540
 				]);
541 541
 			}
542 542
 			throw $ex; // make this bubble up
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 			$this->mkdir($to);
612 612
 
613 613
 			foreach ($cache->getFolderContentsById($sourceEntry->getId()) as $child) {
614
-				$this->copyInner($child, $to . '/' . $child->getName());
614
+				$this->copyInner($child, $to.'/'.$child->getName());
615 615
 			}
616 616
 		} else {
617 617
 			$this->copyFile($sourceEntry, $to);
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 		$cacheEntry = $this->getCache()->get($targetPath);
667 667
 		$urn = $this->getURN($cacheEntry->getId());
668 668
 
669
-		$result = $this->objectStore->uploadMultipartPart($urn, $writeToken, (int)$chunkId, $data, $size);
669
+		$result = $this->objectStore->uploadMultipartPart($urn, $writeToken, (int) $chunkId, $data, $size);
670 670
 
671 671
 		$parts[$chunkId] = [
672 672
 			'PartNumber' => $chunkId,
@@ -694,11 +694,11 @@  discard block
 block discarded – undo
694 694
 				$stat['mimetype'] = $this->getMimeType($targetPath);
695 695
 				$this->getCache()->update($stat['fileid'], $stat);
696 696
 			}
697
-		} catch (S3MultipartUploadException|S3Exception $e) {
697
+		} catch (S3MultipartUploadException | S3Exception $e) {
698 698
 			$this->objectStore->abortMultipartUpload($urn, $writeToken);
699 699
 			$this->logger->logException($e, [
700 700
 				'app' => 'objectstore',
701
-				'message' => 'Could not compete multipart upload ' . $urn . ' with uploadId ' . $writeToken,
701
+				'message' => 'Could not compete multipart upload '.$urn.' with uploadId '.$writeToken,
702 702
 			]);
703 703
 			throw new GenericFileException('Could not write chunked file');
704 704
 		}
Please login to merge, or discard this patch.