Passed
Push — master ( da6019...057c72 )
by John
15:30 queued 11s
created
lib/private/Files/Cache/Cache.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) {
184 184
 		//fix types
185
-		$data['fileid'] = (int)$data['fileid'];
186
-		$data['parent'] = (int)$data['parent'];
185
+		$data['fileid'] = (int) $data['fileid'];
186
+		$data['parent'] = (int) $data['parent'];
187 187
 		$data['size'] = 0 + $data['size'];
188
-		$data['mtime'] = (int)$data['mtime'];
189
-		$data['storage_mtime'] = (int)$data['storage_mtime'];
190
-		$data['encryptedVersion'] = (int)$data['encrypted'];
191
-		$data['encrypted'] = (bool)$data['encrypted'];
188
+		$data['mtime'] = (int) $data['mtime'];
189
+		$data['storage_mtime'] = (int) $data['storage_mtime'];
190
+		$data['encryptedVersion'] = (int) $data['encrypted'];
191
+		$data['encrypted'] = (bool) $data['encrypted'];
192 192
 		$data['storage_id'] = $data['storage'];
193
-		$data['storage'] = (int)$data['storage'];
193
+		$data['storage'] = (int) $data['storage'];
194 194
 		$data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']);
195 195
 		$data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']);
196 196
 		if ($data['storage_mtime'] == 0) {
197 197
 			$data['storage_mtime'] = $data['mtime'];
198 198
 		}
199
-		$data['permissions'] = (int)$data['permissions'];
199
+		$data['permissions'] = (int) $data['permissions'];
200 200
 		if (isset($data['creation_time'])) {
201
-			$data['creation_time'] = (int)$data['creation_time'];
201
+			$data['creation_time'] = (int) $data['creation_time'];
202 202
 		}
203 203
 		if (isset($data['upload_time'])) {
204
-			$data['upload_time'] = (int)$data['upload_time'];
204
+			$data['upload_time'] = (int) $data['upload_time'];
205 205
 		}
206 206
 		return new CacheEntry($data);
207 207
 	}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 			$files = $result->fetchAll();
235 235
 			$result->closeCursor();
236 236
 
237
-			return array_map(function (array $data) {
237
+			return array_map(function(array $data) {
238 238
 				return self::cacheEntryFromData($data, $this->mimetypeLoader);
239 239
 			}, $files);
240 240
 		}
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 
364 364
 			$query->update('filecache')
365 365
 				->whereFileId($id)
366
-				->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) {
366
+				->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) {
367 367
 					return $query->expr()->orX(
368 368
 						$query->expr()->neq($key, $query->createNamedParameter($value)),
369 369
 						$query->expr()->isNull($key)
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 				$query = $this->getQueryBuilder();
393 393
 				$query->update('filecache_extended')
394 394
 					->whereFileId($id)
395
-					->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) {
395
+					->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) {
396 396
 						return $query->expr()->orX(
397 397
 							$query->expr()->neq($key, $query->createNamedParameter($value)),
398 398
 							$query->expr()->isNull($key)
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 		$id = $result->fetchOne();
490 490
 		$result->closeCursor();
491 491
 
492
-		return $id === false ? -1 : (int)$id;
492
+		return $id === false ? -1 : (int) $id;
493 493
 	}
494 494
 
495 495
 	/**
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 			return -1;
504 504
 		} else {
505 505
 			$parent = $this->getParentPath($file);
506
-			return (int)$this->getId($parent);
506
+			return (int) $this->getId($parent);
507 507
 		}
508 508
 	}
509 509
 
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 	 */
563 563
 	private function getSubFolders(ICacheEntry $entry) {
564 564
 		$children = $this->getFolderContentsById($entry->getId());
565
-		return array_filter($children, function ($child) {
565
+		return array_filter($children, function($child) {
566 566
 			return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER;
567 567
 		});
568 568
 	}
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 		// and collecting all folder ids to later use to delete the filecache entries
582 582
 		while ($entryId = array_pop($queue)) {
583 583
 			$children = $this->getFolderContentsById($entryId);
584
-			$childIds = array_map(function (ICacheEntry $cacheEntry) {
584
+			$childIds = array_map(function(ICacheEntry $cacheEntry) {
585 585
 				return $cacheEntry->getId();
586 586
 			}, $children);
587 587
 
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 			$query->execute();
592 592
 
593 593
 			/** @var ICacheEntry[] $childFolders */
594
-			$childFolders = array_filter($children, function ($child) {
594
+			$childFolders = array_filter($children, function($child) {
595 595
 				return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER;
596 596
 			});
597 597
 			foreach ($childFolders as $folder) {
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 
644 644
 			$sourceData = $sourceCache->get($sourcePath);
645 645
 			if ($sourceData === false) {
646
-				throw new \Exception('Invalid source storage path: ' . $sourcePath);
646
+				throw new \Exception('Invalid source storage path: '.$sourcePath);
647 647
 			}
648 648
 
649 649
 			$sourceId = $sourceData['fileid'];
@@ -653,10 +653,10 @@  discard block
 block discarded – undo
653 653
 			[$targetStorageId, $targetPath] = $this->getMoveInfo($targetPath);
654 654
 
655 655
 			if (is_null($sourceStorageId) || $sourceStorageId === false) {
656
-				throw new \Exception('Invalid source storage id: ' . $sourceStorageId);
656
+				throw new \Exception('Invalid source storage id: '.$sourceStorageId);
657 657
 			}
658 658
 			if (is_null($targetStorageId) || $targetStorageId === false) {
659
-				throw new \Exception('Invalid target storage id: ' . $targetStorageId);
659
+				throw new \Exception('Invalid target storage id: '.$targetStorageId);
660 660
 			}
661 661
 
662 662
 			$this->connection->beginTransaction();
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 					->set('path_hash', $fun->md5($newPathFunction))
676 676
 					->set('path', $newPathFunction)
677 677
 					->where($query->expr()->eq('storage', $query->createNamedParameter($sourceStorageId, IQueryBuilder::PARAM_INT)))
678
-					->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath) . '/%')));
678
+					->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath).'/%')));
679 679
 
680 680
 				try {
681 681
 					$query->execute();
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 		$result->closeCursor();
755 755
 
756 756
 		if ($size !== false) {
757
-			if ((int)$size === -1) {
757
+			if ((int) $size === -1) {
758 758
 				return self::SHALLOW;
759 759
 			} else {
760 760
 				return self::COMPLETE;
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 		$files = $result->fetchAll();
792 792
 		$result->closeCursor();
793 793
 
794
-		return array_map(function (array $data) {
794
+		return array_map(function(array $data) {
795 795
 			return self::cacheEntryFromData($data, $this->mimetypeLoader);
796 796
 		}, $files);
797 797
 	}
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 	private function searchResultToCacheEntries(IResult $result): array {
804 804
 		$files = $result->fetchAll();
805 805
 
806
-		return array_map(function (array $data) {
806
+		return array_map(function(array $data) {
807 807
 			return self::cacheEntryFromData($data, $this->mimetypeLoader);
808 808
 		}, $files);
809 809
 	}
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 		$files = $result->fetchAll();
833 833
 		$result->closeCursor();
834 834
 
835
-		return array_map(function (array $data) {
835
+		return array_map(function(array $data) {
836 836
 			return self::cacheEntryFromData($data, $this->mimetypeLoader);
837 837
 		}, $files);
838 838
 	}
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 				->andWhere($query->expr()->lt('size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)));
923 923
 
924 924
 			$result = $query->execute();
925
-			$size = (int)$result->fetchOne();
925
+			$size = (int) $result->fetchOne();
926 926
 			$result->closeCursor();
927 927
 
928 928
 			return $size;
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
 		$files = $result->fetchAll(\PDO::FETCH_COLUMN);
989 989
 		$result->closeCursor();
990 990
 
991
-		return array_map(function ($id) {
992
-			return (int)$id;
991
+		return array_map(function($id) {
992
+			return (int) $id;
993 993
 		}, $files);
994 994
 	}
995 995
 
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
 			return null;
1040 1040
 		}
1041 1041
 
1042
-		return (string)$path;
1042
+		return (string) $path;
1043 1043
 	}
1044 1044
 
1045 1045
 	/**
@@ -1100,12 +1100,12 @@  discard block
 block discarded – undo
1100 1100
 		$data = $this->cacheEntryToArray($sourceEntry);
1101 1101
 		$fileId = $this->put($targetPath, $data);
1102 1102
 		if ($fileId <= 0) {
1103
-			throw new \RuntimeException("Failed to copy to " . $targetPath . " from cache with source data " . json_encode($data) . " ");
1103
+			throw new \RuntimeException("Failed to copy to ".$targetPath." from cache with source data ".json_encode($data)." ");
1104 1104
 		}
1105 1105
 		if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) {
1106 1106
 			$folderContent = $sourceCache->getFolderContentsById($sourceEntry->getId());
1107 1107
 			foreach ($folderContent as $subEntry) {
1108
-				$subTargetPath = $targetPath . '/' . $subEntry->getName();
1108
+				$subTargetPath = $targetPath.'/'.$subEntry->getName();
1109 1109
 				$this->copyFromCache($sourceCache, $subEntry, $subTargetPath);
1110 1110
 			}
1111 1111
 		}
Please login to merge, or discard this patch.