Passed
Push — develop ( 87f23a...408180 )
by Jens
02:57
created
cloudcontrol/library/storage/JsonStorage.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		 */
45 45
 		private function config()
46 46
 		{
47
-			$storagePath = __DIR__ . '/../../' . $this->storageDir;
47
+			$storagePath = __DIR__.'/../../'.$this->storageDir;
48 48
 			if (realpath($storagePath) === false) {
49 49
 				initFramework();
50 50
 				if (Repository::create($storagePath)) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 					$repository->init();
53 53
 					$this->repository = $repository;
54 54
 				} else {
55
-					throw new \Exception('Could not create repository directory: ' . $storagePath);
55
+					throw new \Exception('Could not create repository directory: '.$storagePath);
56 56
 				}
57 57
 			} else {
58 58
 				$this->repository = new Repository($storagePath);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		 */
216 216
 		public function getDocumentBySlug($slug)
217 217
 		{
218
-			$path = '/' . $slug;
218
+			$path = '/'.$slug;
219 219
 
220 220
 			return $this->repository->getDocumentByPath($path);
221 221
 		}
@@ -225,14 +225,14 @@  discard block
 block discarded – undo
225 225
 		 */
226 226
 		public function saveDocument($postValues)
227 227
 		{
228
-			$oldPath = '/' . $postValues['path'];
228
+			$oldPath = '/'.$postValues['path'];
229 229
 
230 230
 			$container = $this->getDocumentContainerByPath($oldPath);
231 231
 			$documentObject = DocumentFactory::createDocumentFromPostValues($postValues, $this);
232 232
 			if ($container->path === '/') {
233
-				$newPath = $container->path . $documentObject->slug;
233
+				$newPath = $container->path.$documentObject->slug;
234 234
 			} else {
235
-				$newPath = $container->path . '/' . $documentObject->slug;
235
+				$newPath = $container->path.'/'.$documentObject->slug;
236 236
 			}
237 237
 			$documentObject->path = $newPath;
238 238
 			$this->repository->saveDocument($documentObject);
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 		{
243 243
 			$documentObject = DocumentFactory::createDocumentFromPostValues($postValues, $this);
244 244
 			if ($postValues['path'] === '/') {
245
-				$documentObject->path = $postValues['path'] . $documentObject->slug;
245
+				$documentObject->path = $postValues['path'].$documentObject->slug;
246 246
 			} else {
247
-				$documentObject->path = $postValues['path'] . '/' . $documentObject->slug;
247
+				$documentObject->path = $postValues['path'].'/'.$documentObject->slug;
248 248
 			}
249 249
 
250 250
 			$this->repository->saveDocument($documentObject);
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
 		public function deleteDocumentBySlug($slug)
254 254
 		{
255
-			$path = '/' . $slug;
255
+			$path = '/'.$slug;
256 256
 			$this->repository->deleteDocumentByPath($path);
257 257
 		}
258 258
 
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
 		{
268 268
 			$documentFolderObject = DocumentFolderFactory::createDocumentFolderFromPostValues($postValues);
269 269
 			if ($postValues['path'] === '/') {
270
-				$documentFolderObject->path = $postValues['path'] . $documentFolderObject->slug;
270
+				$documentFolderObject->path = $postValues['path'].$documentFolderObject->slug;
271 271
 			} else {
272
-				$documentFolderObject->path = $postValues['path'] . '/' . $documentFolderObject->slug;
272
+				$documentFolderObject->path = $postValues['path'].'/'.$documentFolderObject->slug;
273 273
 			}
274 274
 			$this->repository->saveDocument($documentFolderObject);
275 275
 		}
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		 */
284 284
 		public function deleteDocumentFolderBySlug($slug)
285 285
 		{
286
-			$path = '/' . $slug;
286
+			$path = '/'.$slug;
287 287
 			$this->repository->deleteDocumentByPath($path);
288 288
 		}
289 289
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		 */
298 298
 		public function getDocumentFolderBySlug($slug)
299 299
 		{
300
-			$path = '/' . $slug;
300
+			$path = '/'.$slug;
301 301
 
302 302
 			return $this->repository->getDocumentByPath($path);
303 303
 		}
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
 
458 458
 		public function addImage($postValues)
459 459
 		{
460
-			$destinationPath = realpath(__DIR__ . '/../../www/images/');
460
+			$destinationPath = realpath(__DIR__.'/../../www/images/');
461 461
 
462 462
 			$filename = $this->validateFilename($postValues['name'], $destinationPath);
463
-			$destination = $destinationPath . '/' . $filename;
463
+			$destination = $destinationPath.'/'.$filename;
464 464
 
465 465
 			if ($postValues['error'] != '0') {
466
-				throw new \Exception('Error uploading file. Error code: ' . $postValues['error']);
466
+				throw new \Exception('Error uploading file. Error code: '.$postValues['error']);
467 467
 			}
468 468
 
469 469
 			if (move_uploaded_file($postValues['tmp_name'], $destination)) {
@@ -488,14 +488,14 @@  discard block
 block discarded – undo
488 488
 
489 489
 		public function deleteImageByName($filename)
490 490
 		{
491
-			$destinationPath = realpath(__DIR__ . '/../../www/images/');
491
+			$destinationPath = realpath(__DIR__.'/../../www/images/');
492 492
 
493 493
 			$images = $this->getImages();
494 494
 
495 495
 			foreach ($images as $key => $image) {
496 496
 				if ($image->file == $filename) {
497 497
 					foreach ($image->set as $imageSetFilename) {
498
-						$destination = $destinationPath . '/' . $imageSetFilename;
498
+						$destination = $destinationPath.'/'.$imageSetFilename;
499 499
 						if (file_exists($destination)) {
500 500
 							unlink($destination);
501 501
 						} else {
@@ -565,13 +565,13 @@  discard block
 block discarded – undo
565 565
 
566 566
 		public function addFile($postValues)
567 567
 		{
568
-			$destinationPath = realpath(__DIR__ . '/../../www/files/');
568
+			$destinationPath = realpath(__DIR__.'/../../www/files/');
569 569
 
570 570
 			$filename = $this->validateFilename($postValues['name'], $destinationPath);
571
-			$destination = $destinationPath . '/' . $filename;
571
+			$destination = $destinationPath.'/'.$filename;
572 572
 
573 573
 			if ($postValues['error'] != '0') {
574
-				throw new \Exception('Error uploading file. Error code: ' . $postValues['error']);
574
+				throw new \Exception('Error uploading file. Error code: '.$postValues['error']);
575 575
 			}
576 576
 
577 577
 			if (move_uploaded_file($postValues['tmp_name'], $destination)) {
@@ -597,19 +597,19 @@  discard block
 block discarded – undo
597 597
 				array_pop($fileParts);
598 598
 				$fileNameWithoutExtension = implode('-', $fileParts);
599 599
 				$fileNameWithoutExtension = slugify($fileNameWithoutExtension);
600
-				$filename = $fileNameWithoutExtension . '.' . $extension;
600
+				$filename = $fileNameWithoutExtension.'.'.$extension;
601 601
 			} else {
602 602
 				$filename = slugify($filename);
603 603
 			}
604 604
 
605
-			if (file_exists($path . '/' . $filename)) {
605
+			if (file_exists($path.'/'.$filename)) {
606 606
 				$fileParts = explode('.', $filename);
607 607
 				if (count($fileParts) > 1) {
608 608
 					$extension = end($fileParts);
609 609
 					array_pop($fileParts);
610 610
 					$fileNameWithoutExtension = implode('-', $fileParts);
611 611
 					$fileNameWithoutExtension .= '-copy';
612
-					$filename = $fileNameWithoutExtension . '.' . $extension;
612
+					$filename = $fileNameWithoutExtension.'.'.$extension;
613 613
 				} else {
614 614
 					$filename .= '-copy';
615 615
 				}
@@ -644,8 +644,8 @@  discard block
 block discarded – undo
644 644
 		 */
645 645
 		public function deleteFileByName($filename)
646 646
 		{
647
-			$destinationPath = realpath(__DIR__ . '/../../www/files/');
648
-			$destination = $destinationPath . '/' . $filename;
647
+			$destinationPath = realpath(__DIR__.'/../../www/files/');
648
+			$destination = $destinationPath.'/'.$filename;
649 649
 
650 650
 			if (file_exists($destination)) {
651 651
 				$files = $this->getFiles();
Please login to merge, or discard this patch.