Passed
Push — develop ( fc7043...b7cd40 )
by Jens
02:53
created
cloudcontrol/library/storage/JsonStorage.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -2,19 +2,19 @@  discard block
 block discarded – undo
2 2
 namespace library\storage
3 3
 {
4 4
 
5
-    use library\crypt\Crypt;
6
-    use library\images\ImageResizer;
5
+	use library\crypt\Crypt;
6
+	use library\images\ImageResizer;
7 7
 
8
-    /**
8
+	/**
9 9
 	 * Class JsonStorage
10 10
 	 * @package library\storage
11 11
 	 */
12 12
 	class JsonStorage implements Storage
13 13
 	{
14 14
 		private $storageDir;
15
-        /**
16
-         * @var Repository
17
-         */
15
+		/**
16
+		 * @var Repository
17
+		 */
18 18
 		private $repository;
19 19
 
20 20
 		/**
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 			if (!empty($doesItExist)) {
125 125
 				throw new \Exception('Trying to add username that already exists.');
126 126
 			}
127
-            $users = $this->repository->users;
128
-            $users[] = $userObj;
129
-            $this->repository->users = $users;
127
+			$users = $this->repository->users;
128
+			$users[] = $userObj;
129
+			$this->repository->users = $users;
130 130
 			$this->save();
131 131
 		}
132 132
 
@@ -194,40 +194,40 @@  discard block
 block discarded – undo
194 194
 		 */
195 195
 		public function getDocumentBySlug($slug)
196 196
 		{
197
-            $path = '/' . $slug;
197
+			$path = '/' . $slug;
198 198
 			return $this->repository->getDocumentByPath($path);
199 199
 		}
200 200
 
201 201
 		public function saveDocument($postValues)
202 202
 		{
203
-            $oldPath = '/' . $postValues['path'];
203
+			$oldPath = '/' . $postValues['path'];
204 204
 
205
-            $container = $this->getDocumentContainerByPath($oldPath);
206
-            $documentObject = $this->createDocumentFromPostValues($postValues);
207
-            if ($container->path === '/') {
208
-                $newPath = $container->path . $documentObject->slug;
209
-            } else {
210
-                $newPath = $container->path . '/' . $documentObject->slug;
211
-            }
212
-            $documentObject->path = $newPath;
213
-            $this->repository->saveDocument($documentObject);
214
-        }
205
+			$container = $this->getDocumentContainerByPath($oldPath);
206
+			$documentObject = $this->createDocumentFromPostValues($postValues);
207
+			if ($container->path === '/') {
208
+				$newPath = $container->path . $documentObject->slug;
209
+			} else {
210
+				$newPath = $container->path . '/' . $documentObject->slug;
211
+			}
212
+			$documentObject->path = $newPath;
213
+			$this->repository->saveDocument($documentObject);
214
+		}
215 215
 
216 216
 		public function addDocument($postValues)
217 217
 		{
218 218
 			$documentObject = $this->createDocumentFromPostValues($postValues);
219
-            if ($postValues['path'] === '/') {
220
-                $documentObject->path = $postValues['path'] . $documentObject->slug;
221
-            } else {
222
-                $documentObject->path = $postValues['path'] . '/' . $documentObject->slug;
223
-            }
219
+			if ($postValues['path'] === '/') {
220
+				$documentObject->path = $postValues['path'] . $documentObject->slug;
221
+			} else {
222
+				$documentObject->path = $postValues['path'] . '/' . $documentObject->slug;
223
+			}
224 224
 
225
-            $this->repository->saveDocument($documentObject);
225
+			$this->repository->saveDocument($documentObject);
226 226
 		}
227 227
 
228 228
 		public function deleteDocumentBySlug($slug)
229 229
 		{
230
-            $path = '/' . $slug;
230
+			$path = '/' . $slug;
231 231
 			$this->repository->deleteDocumentByPath($path);
232 232
 		}
233 233
 
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
 		 */
308 308
 		public function addDocumentFolder($postValues)
309 309
 		{
310
-            $documentFolderObject = $this->createDocumentFolderFromPostValues($postValues);
311
-            if ($postValues['path'] === '/') {
312
-                $documentFolderObject->path = $postValues['path'] . $documentFolderObject->slug;
313
-            } else {
314
-                $documentFolderObject->path = $postValues['path'] . '/' . $documentFolderObject->slug;
315
-            }
316
-            $this->repository->saveDocument($documentFolderObject);
310
+			$documentFolderObject = $this->createDocumentFolderFromPostValues($postValues);
311
+			if ($postValues['path'] === '/') {
312
+				$documentFolderObject->path = $postValues['path'] . $documentFolderObject->slug;
313
+			} else {
314
+				$documentFolderObject->path = $postValues['path'] . '/' . $documentFolderObject->slug;
315
+			}
316
+			$this->repository->saveDocument($documentFolderObject);
317 317
 		}
318 318
 
319 319
 		/**
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 		 */
326 326
 		public function deleteDocumentFolderBySlug($slug)
327 327
 		{
328
-            $path = '/' . $slug;
328
+			$path = '/' . $slug;
329 329
 			$this->repository->deleteDocumentByPath($path);
330 330
 		}
331 331
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 		 */
340 340
 		public function getDocumentFolderBySlug($slug)
341 341
 		{
342
-            $path = '/' . $slug;
342
+			$path = '/' . $slug;
343 343
 			return $this->repository->getDocumentByPath($path);
344 344
 		}
345 345
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		 */
353 353
 		public function saveDocumentFolder($postValues)
354 354
 		{
355
-            $this->addDocumentFolder($postValues);
355
+			$this->addDocumentFolder($postValues);
356 356
 		}
357 357
 
358 358
 		/**
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 		 */
366 366
 		private function getDocumentContainerByPath($path)
367 367
 		{
368
-            return $this->repository->getDocumentContainerByPath($path);
368
+			return $this->repository->getDocumentContainerByPath($path);
369 369
 		}
370 370
 
371 371
 		/**
@@ -569,9 +569,9 @@  discard block
 block discarded – undo
569 569
 				$imageObject->size = $postValues['size'];
570 570
 				$imageObject->set = $fileNames;
571 571
 
572
-                $images = $this->repository->images;
572
+				$images = $this->repository->images;
573 573
 				$images[] = $imageObject;
574
-                $this->repository->images = $images;
574
+				$this->repository->images = $images;
575 575
 
576 576
 				$this->save();
577 577
 			} else {
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 		/**
607 607
 		 * @param $filename
608 608
 		 * @return null
609
-         */
609
+		 */
610 610
 		public function getImageByName($filename)
611 611
 		{
612 612
 			$images = $this->getImages();
@@ -657,9 +657,9 @@  discard block
 block discarded – undo
657 657
 				$file->type = $postValues['type'];
658 658
 				$file->size = $postValues['size'];
659 659
 
660
-                $files = $this->repository->files;
660
+				$files = $this->repository->files;
661 661
 				$files[] = $file;
662
-                $this->repository->files = $files;
662
+				$this->repository->files = $files;
663 663
 				$this->save();
664 664
 			} else {
665 665
 				throw new \Exception('Error moving uploaded file');
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 		/**
699 699
 		 * @param $filename
700 700
 		 * @return null
701
-         */
701
+		 */
702 702
 		public function getFileByName($filename)
703 703
 		{
704 704
 			$files = $this->getFiles();
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 		/**
714 714
 		 * @param $filename
715 715
 		 * @throws \Exception
716
-         */
716
+		 */
717 717
 		public function deleteFileByName($filename)
718 718
 		{
719 719
 			$destinationPath = realpath(__DIR__ . '/../../www/files/');
@@ -758,9 +758,9 @@  discard block
 block discarded – undo
758 758
 		{
759 759
 			$documentTypeObject = $this->createDocumentTypeFromPostValues($postValues);
760 760
 
761
-            $documentTypes = $this->repository->documentTypes;
762
-            $documentTypes[] = $documentTypeObject;
763
-            $this->repository->documentTypes = $documentTypes;
761
+			$documentTypes = $this->repository->documentTypes;
762
+			$documentTypes[] = $documentTypeObject;
763
+			$this->repository->documentTypes = $documentTypes;
764 764
 
765 765
 			$this->save();
766 766
 		}
@@ -906,9 +906,9 @@  discard block
 block discarded – undo
906 906
 		{
907 907
 			$brickObject = $this->createBrickFromPostValues($postValues);
908 908
 
909
-            $bricks = $this->repository->bricks;
910
-            $bricks[] = $brickObject;
911
-            $this->repository->bricks = $bricks;
909
+			$bricks = $this->repository->bricks;
910
+			$bricks[] = $brickObject;
911
+			$this->repository->bricks = $bricks;
912 912
 
913 913
 			$this->save();
914 914
 		}
@@ -1113,9 +1113,9 @@  discard block
 block discarded – undo
1113 1113
 		{
1114 1114
 			$imageSetObject = $this->createImageSetFromPostValues($postValues);
1115 1115
 
1116
-            $imageSet = $this->repository->imageSet;
1117
-            $imageSet[] = $imageSetObject;
1118
-            $this->repository->imageSet = $imageSet;
1116
+			$imageSet = $this->repository->imageSet;
1117
+			$imageSet[] = $imageSetObject;
1118
+			$this->repository->imageSet = $imageSet;
1119 1119
 
1120 1120
 			$this->save();
1121 1121
 		}
Please login to merge, or discard this patch.