Passed
Push — develop ( 4abc61...39fefa )
by Jens
03:39
created
cloudcontrol/library/images/ImageResizer.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 				}
44 44
 				return $returnFileNames;
45 45
 			} else {
46
-				throw new \Exception('Image doesnt exist: ' . $imagePath);
46
+				throw new \Exception('Image doesnt exist: '.$imagePath);
47 47
 			}
48 48
 		}
49 49
 
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 		 * @return string
55 55
 		 * @throws \Exception
56 56
 		 */
57
-		public function resize($imagePath='', $width='',$height='')
57
+		public function resize($imagePath = '', $width = '', $height = '')
58 58
 		{
59
-			$modifier = '-r' . $width . 'x' . $height;
60
-			return $this->applyMethod('Resize', $imagePath, $width,$height, $modifier);
59
+			$modifier = '-r'.$width.'x'.$height;
60
+			return $this->applyMethod('Resize', $imagePath, $width, $height, $modifier);
61 61
 		}
62 62
 
63 63
 		/**
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		 * @return string
68 68
 		 * @throws \Exception
69 69
 		 */
70
-		public function smartcrop($imagePath='', $width='',$height='')
70
+		public function smartcrop($imagePath = '', $width = '', $height = '')
71 71
 		{
72
-			$modifier = '-s' . $width . 'x' . $height;
73
-			return $this->applyMethod('SmartCrop', $imagePath, $width,$height, $modifier);
72
+			$modifier = '-s'.$width.'x'.$height;
73
+			return $this->applyMethod('SmartCrop', $imagePath, $width, $height, $modifier);
74 74
 		}
75 75
 
76 76
 		/**
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 		 * @return string
81 81
 		 * @throws \Exception
82 82
 		 */
83
-		public function boxcrop($imagePath='', $width='',$height='')
83
+		public function boxcrop($imagePath = '', $width = '', $height = '')
84 84
 		{
85
-			$modifier = '-b' . $width . 'x' . $height;
86
-			return $this->applyMethod('BoxCrop', $imagePath, $width,$height, $modifier);
85
+			$modifier = '-b'.$width.'x'.$height;
86
+			return $this->applyMethod('BoxCrop', $imagePath, $width, $height, $modifier);
87 87
 		}
88 88
 
89 89
 		/**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		 *
93 93
 		 * @return string
94 94
 		 */
95
-		private function modifyName($imagePath, $modifier='')
95
+		private function modifyName($imagePath, $modifier = '')
96 96
 		{
97 97
 			$filename = basename($imagePath);
98 98
 			$path = dirname($imagePath);
@@ -102,30 +102,30 @@  discard block
 block discarded – undo
102 102
 				array_pop($fileParts);
103 103
 				$fileNameWithoutExtension = implode('-', $fileParts);
104 104
 				$fileNameWithoutExtension = slugify($fileNameWithoutExtension);
105
-				$filename = $fileNameWithoutExtension . $modifier  . '.' . $extension;
105
+				$filename = $fileNameWithoutExtension.$modifier.'.'.$extension;
106 106
 			} else {
107 107
 				$filename = slugify($filename);
108 108
 			}
109 109
 
110
-			if (file_exists($path . '/' . $filename)) {
110
+			if (file_exists($path.'/'.$filename)) {
111 111
 				$fileParts = explode('.', $filename);
112 112
 				if (count($fileParts) > 1) {
113 113
 					$extension = end($fileParts);
114 114
 					array_pop($fileParts);
115 115
 					$fileNameWithoutExtension = implode('-', $fileParts);
116 116
 					$fileNameWithoutExtension .= '-copy';
117
-					$filename = $fileNameWithoutExtension . '.' . $extension;
117
+					$filename = $fileNameWithoutExtension.'.'.$extension;
118 118
 				} else {
119 119
 					$filename .= '-copy';
120 120
 				}
121
-				return $this->modifyName($path . '/' . $filename);
121
+				return $this->modifyName($path.'/'.$filename);
122 122
 			}
123
-			return $path . '/' . $filename;
123
+			return $path.'/'.$filename;
124 124
 		}
125 125
 
126 126
 		private function applyMethod($method, $imagePath, $width, $height, $modifier)
127 127
 		{
128
-			$method = 'library\\images\\methods\\' . $method;
128
+			$method = 'library\\images\\methods\\'.$method;
129 129
 			$destination = $this->modifyName($imagePath, $modifier);
130 130
 			if (file_exists($imagePath)) {
131 131
 				$image = new Image();
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 				$resizedImage->saveImage($destination, $resizedImage->getImageMimeType($imagePath), 80);
140 140
 				return basename($destination);
141 141
 			} else {
142
-				throw new \Exception('Image doesnt exist: ' . $imagePath);
142
+				throw new \Exception('Image doesnt exist: '.$imagePath);
143 143
 			}
144 144
 		}
145 145
 	}
Please login to merge, or discard this patch.
cloudcontrol/library/cc/Application.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		 */
64 64
 		private function config()
65 65
 		{
66
-			$configPath = __DIR__ . '/../../config.json';
66
+			$configPath = __DIR__.'/../../config.json';
67 67
 			if (realpath($configPath) !== false) {
68 68
 				$json = file_get_contents($configPath);
69 69
 				$this->config = json_decode($json);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		private function sitemapMatching($request)
91 91
 		{
92 92
 			$sitemap = $this->storage->getSitemap()->getSitemap();
93
-			$relativeUri = '/' . $request::$relativeUri;
93
+			$relativeUri = '/'.$request::$relativeUri;
94 94
 
95 95
 			foreach ($sitemap as $sitemapItem) {
96 96
 				if ($sitemapItem->regex) {
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 		 * @return mixed
154 154
 		 * @throws \Exception
155 155
 		 */
156
-		private function getComponentObject($class='', $template='', $parameters=array(), $matchedSitemapItem)
156
+		private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem)
157 157
 		{
158
-			$libraryComponentName = '\\library\\components\\' . $class;
159
-			$userComponentName = '\\components\\' . $class;
158
+			$libraryComponentName = '\\library\\components\\'.$class;
159
+			$userComponentName = '\\components\\'.$class;
160 160
 
161 161
 			if (AutoloadUtil::autoLoad($libraryComponentName, false)) {
162 162
 				$component = new $libraryComponentName($template, $this->request, $parameters, $matchedSitemapItem);
163 163
 			} elseif (AutoloadUtil::autoLoad($userComponentName, false)) {
164 164
 				$component = new $userComponentName($template, $this->request, $parameters, $matchedSitemapItem);
165 165
 			} else {
166
-				throw new \Exception('Could not load component ' . $class);
166
+				throw new \Exception('Could not load component '.$class);
167 167
 			}
168 168
 			
169 169
 			if (!$component instanceof Component) {
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		public function setCachingHeaders()
223 223
 		{
224 224
 			header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 2))); // 2 days
225
-			header("Cache-Control: max-age=" . (60 * 60 * 24 * 2));
225
+			header("Cache-Control: max-age=".(60 * 60 * 24 * 2));
226 226
 		}
227 227
 
228 228
 		/**
Please login to merge, or discard this patch.
cloudcontrol/library/storage/Storage.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.