Passed
Push — develop ( a5e1bf...c22bc5 )
by Jens
02:34
created
src/cc/Application.php 2 patches
Doc Comments   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,6 +83,9 @@  discard block
 block discarded – undo
83 83
             $this->storage = new Storage($this->getStorageDir(), $this->config->imagesDir, $this->config->filesDir);
84 84
         }
85 85
 
86
+        /**
87
+         * @param Request $request
88
+         */
86 89
         private function redirectMatching($request)
87 90
         {
88 91
             $redirects = $this->storage->getRedirects()->getRedirects();
@@ -112,7 +115,7 @@  discard block
 block discarded – undo
112 115
          * Loop through sitemap items and see if one matches the requestUri.
113 116
          * If it does, add it tot the matchedSitemapItems array
114 117
          *
115
-         * @param $request
118
+         * @param Request $request
116 119
          */
117 120
         private function sitemapMatching($request)
118 121
         {
@@ -177,7 +180,7 @@  discard block
 block discarded – undo
177 180
          * @param array $parameters
178 181
          * @param \stdClass|null $matchedSitemapItem
179 182
          *
180
-         * @return mixed
183
+         * @return Component
181 184
          * @throws \Exception
182 185
          */
183 186
         private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem)
@@ -268,6 +271,9 @@  discard block
 block discarded – undo
268 271
             return $this->config->templateDir;
269 272
         }
270 273
 
274
+        /**
275
+         * @return string
276
+         */
271 277
         public function getStorageDir()
272 278
         {
273 279
             return $this->config->storageDir;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
          */
67 67
         private function config()
68 68
         {
69
-            $configPath = __DIR__ . '/../../config.json';
69
+            $configPath = __DIR__.'/../../config.json';
70 70
             if (realpath($configPath) !== false) {
71 71
                 $json = file_get_contents($configPath);
72 72
                 $this->config = json_decode($json);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         private function redirectMatching($request)
87 87
         {
88 88
             $redirects = $this->storage->getRedirects()->getRedirects();
89
-            $relativeUri = '/' . $request::$relativeUri;
89
+            $relativeUri = '/'.$request::$relativeUri;
90 90
 
91 91
             foreach ($redirects as $redirect) {
92 92
                 if (preg_match_all($redirect->fromUrl, $relativeUri, $matches)) {
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
                     }
97 97
                     if ($redirect->type == '301') {
98 98
                         header('HTTP/1.1 301 Moved Permanently');
99
-                        header('Location: ' . $request::$subfolders . $toUrl);
99
+                        header('Location: '.$request::$subfolders.$toUrl);
100 100
                         exit;
101 101
                     } elseif ($redirect->type == '302') {
102
-                        header('Location: ' . $request::$subfolders . $toUrl, true, 302);
102
+                        header('Location: '.$request::$subfolders.$toUrl, true, 302);
103 103
                         exit;
104 104
                     } else {
105 105
                         throw new \Exception('Invalid redirect type.');
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         private function sitemapMatching($request)
118 118
         {
119 119
             $sitemap = $this->storage->getSitemap()->getSitemap();
120
-            $relativeUri = '/' . $request::$relativeUri;
120
+            $relativeUri = '/'.$request::$relativeUri;
121 121
 
122 122
             foreach ($sitemap as $sitemapItem) {
123 123
                 if ($sitemapItem->regex) {
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
          */
183 183
         private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem)
184 184
         {
185
-            $libraryComponentName = '\\CloudControl\Cms\\components\\' . $class;
186
-            $userComponentName = '\\components\\' . $class;
185
+            $libraryComponentName = '\\CloudControl\Cms\\components\\'.$class;
186
+            $userComponentName = '\\components\\'.$class;
187 187
 
188 188
             if (!class_exists($libraryComponentName, false)) {
189 189
                 $component = new $libraryComponentName($template, $this->request, $parameters, $matchedSitemapItem);
190 190
             } elseif (!class_exists($userComponentName, false)) {
191 191
                 $component = new $userComponentName($template, $this->request, $parameters, $matchedSitemapItem);
192 192
             } else {
193
-                throw new \Exception('Could not load component ' . $class);
193
+                throw new \Exception('Could not load component '.$class);
194 194
             }
195 195
 
196 196
             if (!$component instanceof Component) {
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
          */
249 249
         public function setCachingHeaders()
250 250
         {
251
-            header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 2))); // 2 days
252
-            header("Cache-Control: max-age=" . (60 * 60 * 24 * 2));
251
+            header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 2))); // 2 days
252
+            header("Cache-Control: max-age=".(60 * 60 * 24 * 2));
253 253
         }
254 254
 
255 255
         /**
Please login to merge, or discard this patch.
src/components/BaseComponent.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -141,8 +141,8 @@
 block discarded – undo
141 141
 		}
142 142
 
143 143
         /**
144
-         * @param $template
145
-         * @param null $application
144
+         * @param string $template
145
+         * @param null|Application $application
146 146
          * @return string
147 147
          */
148 148
         protected function getTemplatePath($template, $application=null)
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		 * @param array   $parameters
41 41
 		 * @param         $matchedSitemapItem
42 42
 		 */
43
-		public function __construct($template='', Request $request, $parameters=array(), $matchedSitemapItem)
43
+		public function __construct($template = '', Request $request, $parameters = array(), $matchedSitemapItem)
44 44
 		{
45 45
 			$this->template = $template;
46 46
 			$this->request = $request;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		 *
66 66
 		 * @throws \Exception
67 67
 		 */
68
-		public function render($application=null)
68
+		public function render($application = null)
69 69
 		{
70 70
 			$this->renderedContent = $this->renderTemplate($this->template, true, $application);
71 71
 		}
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		 * @return string
92 92
 		 * @throws \Exception
93 93
 		 */
94
-		public function renderTemplate($template='', $obClean = true, $application=null)
94
+		public function renderTemplate($template = '', $obClean = true, $application = null)
95 95
 		{
96 96
 		    $templatePath = $this->getTemplatePath($template, $application);
97 97
 			if (realpath($templatePath) !== false) {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 				return ob_get_contents();
111 111
 			} else {
112 112
 				if ($template !== null) { // If template is null, its a application component, which doesnt have a template
113
-					throw new \Exception('Couldnt find template ' . $templatePath);
113
+					throw new \Exception('Couldnt find template '.$templatePath);
114 114
 				}
115 115
 			}
116 116
 		}
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		 * @return string
126 126
 		 * @throws \Exception
127 127
 		 */
128
-		public function includeTemplate($template='', $parameters = array())
128
+		public function includeTemplate($template = '', $parameters = array())
129 129
 		{
130 130
 			if (is_array($parameters)) {
131 131
 				foreach ($parameters as $name => $value) {
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
          * @param null $application
146 146
          * @return string
147 147
          */
148
-        protected function getTemplatePath($template, $application=null)
148
+        protected function getTemplatePath($template, $application = null)
149 149
         {
150 150
             $templatePath = $application->getTemplatePath();
151
-            $templatePath = $templatePath . DIRECTORY_SEPARATOR . $template . '.php';
151
+            $templatePath = $templatePath.DIRECTORY_SEPARATOR.$template.'.php';
152 152
             return $templatePath;
153 153
         }
154 154
     }
Please login to merge, or discard this patch.
src/components/cms/FilesRouting.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	}
69 69
 
70 70
 	/**
71
-	 * @param $request
71
+	 * @param Request $request
72 72
 	 * @param CmsComponent $cmsComponent
73 73
 	 */
74 74
 	private function newRoute($request, $cmsComponent)
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	}
84 84
 
85 85
 	/**
86
-	 * @param $request
86
+	 * @param Request $request
87 87
 	 * @param CmsComponent $cmsComponent
88 88
 	 */
89 89
 	private function deleteRoute($request, $cmsComponent)
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,21 +40,21 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		$file = $cmsComponent->storage->getFiles()->getFileByName($slug);
42 42
 		// TODO FIX THIS PATH
43
-		$path = realpath(__DIR__ . '/../www/files/');
44
-		$quoted = sprintf('"%s"', addcslashes(basename($path . '/' . $file->file), '"\\'));
45
-		$size = filesize($path . '/' . $file->file);
43
+		$path = realpath(__DIR__.'/../www/files/');
44
+		$quoted = sprintf('"%s"', addcslashes(basename($path.'/'.$file->file), '"\\'));
45
+		$size = filesize($path.'/'.$file->file);
46 46
 
47 47
 		header('Content-Description: File Transfer');
48
-		header('Content-Type: ' . $file->type);
49
-		header('Content-Disposition: attachment; filename=' . $quoted);
48
+		header('Content-Type: '.$file->type);
49
+		header('Content-Disposition: attachment; filename='.$quoted);
50 50
 		header('Content-Transfer-Encoding: binary');
51 51
 		header('Connection: Keep-Alive');
52 52
 		header('Expires: 0');
53 53
 		header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
54 54
 		header('Pragma: public');
55
-		header('Content-Length: ' . $size);
55
+		header('Content-Length: '.$size);
56 56
 
57
-		readfile($path . '/' . $file->file);
57
+		readfile($path.'/'.$file->file);
58 58
 		exit;
59 59
 	}
60 60
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		$cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_FILES);
79 79
 		if (isset($_FILES[CmsComponent::FILES_PARAMETER_FILE])) {
80 80
 			$cmsComponent->storage->getFiles()->addFile($_FILES[CmsComponent::FILES_PARAMETER_FILE]);
81
-			header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/files');
81
+			header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/files');
82 82
 			exit;
83 83
 		}
84 84
 	}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	private function deleteRoute($request, $cmsComponent)
91 91
 	{
92 92
 		$cmsComponent->storage->getFiles()->deleteFileByName($request::$get[CmsComponent::FILES_PARAMETER_FILE]);
93
-		header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/files');
93
+		header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/files');
94 94
 		exit;
95 95
 	}
96 96
 
Please login to merge, or discard this patch.
src/components/FormComponent.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	}
181 181
 
182 182
 	/**
183
-	 * @param \cc\Request $request
183
+	 * @param \CloudControl\Cms\cc\Request $request
184 184
 	 * @return array
185 185
 	 */
186 186
 	private function getPostValues($request)
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	}
292 292
 
293 293
 	/**
294
-	 * @return \cc\Request
294
+	 * @return \CloudControl\Cms\cc\Request
295 295
 	 */
296 296
 	private function setPathBackup()
297 297
 	{
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	}
306 306
 
307 307
 	/**
308
-	 * @param \cc\Request $request
308
+	 * @param \CloudControl\Cms\cc\Request $request
309 309
 	 */
310 310
 	private function resetPathBackup($request)
311 311
 	{
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	}
318 318
 
319 319
 	/**
320
-	 * @param $form
320
+	 * @param string|null $form
321 321
 	 */
322 322
 	private function setFormParameter($form)
323 323
 	{
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		if (isset($_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID])) {
163 163
 			$this->formId = $_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID];
164 164
 		} else {
165
-			$_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID] = (string)microtime(true);
165
+			$_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID] = (string) microtime(true);
166 166
 			$_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName]['submitted'] = false;
167 167
 			$this->formId = $_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID];
168 168
 		}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		$postValues = $request::$post;
191 191
 		$postValues[self::PARAMETER_DOCUMENT_TYPE] = $this->documentType;
192 192
 		$postValues[self::GET_PARAMETER_PATH] = $this->responseFolder;
193
-		$postValues['title'] = date('r') . ' - From: ' . $request::$requestUri;
193
+		$postValues['title'] = date('r').' - From: '.$request::$requestUri;
194 194
 
195 195
 		return $postValues;
196 196
 	}
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	private function setFormParameter($form)
326 326
 	{
327 327
 		if ($this->isFormSubmitted($this->request) || $this->isSubmitAllowed() === false) {
328
-			$this->parameters[$this->formParameterName] = '<a name="' . $this->formId . '"></a>' . $this->thankYouMessage;
328
+			$this->parameters[$this->formParameterName] = '<a name="'.$this->formId.'"></a>'.$this->thankYouMessage;
329 329
 		} else {
330 330
 			$this->parameters[$this->formParameterName] = $form;
331 331
 		}
Please login to merge, or discard this patch.
src/images/Image.php 2 patches
Doc Comments   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		 * @param string $imagePath
77 77
 		 * @param bool   $getExtension
78 78
 		 *
79
-		 * @return bool|int|string
79
+		 * @return integer
80 80
 		 */
81 81
 		public function getImageMimeType($imagePath, $getExtension = false)
82 82
 		{
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		}
150 150
 
151 151
 		/**
152
-		 * @param $pathToBitmapFile
152
+		 * @param string $pathToBitmapFile
153 153
 		 *
154 154
 		 * @return string
155 155
 		 */
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		}
166 166
 
167 167
 		/**
168
-		 * @param $header
168
+		 * @param string $header
169 169
 		 *
170 170
 		 * @return array
171 171
 		 */
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 		 * Loop through the data in the body of the bitmap
196 196
 		 * file and calculate each individual pixel based on the
197 197
 		 * bytes
198
-		 * @param $bodySize
199
-		 * @param $x
198
+		 * @param integer $bodySize
199
+		 * @param integer $x
200 200
 		 * @param $width
201
-		 * @param $usePadding
202
-		 * @param $y
201
+		 * @param boolean $usePadding
202
+		 * @param integer $y
203 203
 		 * @param $height
204
-		 * @param $body
205
-		 * @param $image
204
+		 * @param string $body
205
+		 * @param resource $image
206 206
 		 */
207 207
 		private function loopThroughBodyAndCalculatePixels($bodySize, $x, $width, $usePadding, $y, $height, $body, $image)
208 208
 		{
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 			} elseif (is_string($imageContainer)) {
36 36
 				$this->_imageResource = imagecreatefromstring($imageContainer);
37 37
 			} else {
38
-				throw new \Exception('Could not create image resource, accepted inputs are: "resource of type (gd)", path_to_image and "string". <br /><pre>' . var_export($imageContainer, true) . '</pre>');
38
+				throw new \Exception('Could not create image resource, accepted inputs are: "resource of type (gd)", path_to_image and "string". <br /><pre>'.var_export($imageContainer, true).'</pre>');
39 39
 			}
40 40
 		}
41 41
 
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 				//    Cut it in parts of 2 bytes
180 180
 				$header_parts = str_split($header, 2);
181 181
 				//    Get the width        4 bytes
182
-				$width = hexdec($header_parts[19] . $header_parts[18]);
182
+				$width = hexdec($header_parts[19].$header_parts[18]);
183 183
 				//    Get the height        4 bytes
184
-				$height = hexdec($header_parts[23] . $header_parts[22]);
184
+				$height = hexdec($header_parts[23].$header_parts[22]);
185 185
 				//    Unset the header params
186 186
 				unset($header_parts);
187 187
 
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
 				}
227 227
 				//    Calculation of the RGB-pixel (defined as BGR in image-data). Define $iPos as absolute position in the body
228 228
 				$iPos = $i * 2;
229
-				$r = hexdec($body[$iPos + 4] . $body[$iPos + 5]);
230
-				$g = hexdec($body[$iPos + 2] . $body[$iPos + 3]);
231
-				$b = hexdec($body[$iPos] . $body[$iPos + 1]);
229
+				$r = hexdec($body[$iPos + 4].$body[$iPos + 5]);
230
+				$g = hexdec($body[$iPos + 2].$body[$iPos + 3]);
231
+				$b = hexdec($body[$iPos].$body[$iPos + 1]);
232 232
 				//    Calculate and draw the pixel
233 233
 				$color = imagecolorallocate($image, $r, $g, $b);
234 234
 				imagesetpixel($image, $x, $height - $y, $color);
Please login to merge, or discard this patch.
src/storage/storage/ImagesStorage.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -13,6 +13,10 @@
 block discarded – undo
13 13
 {
14 14
     protected $imagesDir;
15 15
 
16
+    /**
17
+     * @param \CloudControl\Cms\storage\Repository $repository
18
+     * @param string $imagesDir
19
+     */
16 20
     public function __construct($repository, $imagesDir)
17 21
     {
18 22
         parent::__construct($repository);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
         $destinationPath = $this->getDestinationPath();
46 46
 
47 47
         $filename = $this->validateFilename($postValues['name'], $destinationPath);
48
-        $destination = $destinationPath . DIRECTORY_SEPARATOR . $filename;
48
+        $destination = $destinationPath.DIRECTORY_SEPARATOR.$filename;
49 49
 
50 50
         if ($postValues['error'] != '0') {
51
-            throw new \Exception('Error uploading file. Error code: ' . $postValues['error']);
51
+            throw new \Exception('Error uploading file. Error code: '.$postValues['error']);
52 52
         }
53 53
 
54 54
         if (move_uploaded_file($postValues['tmp_name'], $destination)) {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         foreach ($images as $key => $image) {
81 81
             if ($image->file == $filename) {
82 82
                 foreach ($image->set as $imageSetFilename) {
83
-                    $destination = $destinationPath . '/' . $imageSetFilename;
83
+                    $destination = $destinationPath.'/'.$imageSetFilename;
84 84
                     if (file_exists($destination)) {
85 85
                         unlink($destination);
86 86
                     } else {
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     private function getDestinationPath()
130 130
     {
131
-        $destinationPath = realpath($this->imagesDir . DIRECTORY_SEPARATOR);
131
+        $destinationPath = realpath($this->imagesDir.DIRECTORY_SEPARATOR);
132 132
         return $destinationPath;
133 133
     }
134 134
 }
135 135
\ No newline at end of file
Please login to merge, or discard this patch.
src/images/methods/Resize.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 			
64 64
 			// Define the ratio and adjust the width and height
65 65
 			if ($this->_preserveAspectRatio) {
66
-				$ratio = min($this->_width/$originalWidth, $this->_height/$originalHeight);
66
+				$ratio = min($this->_width / $originalWidth, $this->_height / $originalHeight);
67 67
 				$this->_width = $originalWidth * $ratio;
68 68
 				$this->_height = $originalHeight * $ratio;
69 69
 			}
Please login to merge, or discard this patch.
src/images/methods/BoxCrop.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@
 block discarded – undo
26 26
 			
27 27
 			// Define which ratio will be used, depending on which is the smallest side
28 28
 			$ratio = min($hRatio, $wRatio);
29
-			if($ratio > 1) $ratio = 1;
29
+			if ($ratio > 1) $ratio = 1;
30 30
 			
31 31
 			// Define sizes
32 32
 			$this->_destWidth = floor($originalWidth * $ratio);
33 33
 			$this->_destHeight = floor($originalHeight * $ratio);
34 34
 			
35 35
 			// Define margins
36
-			$this->_destX = floor(($this->_width  - $this->_destWidth) / 2);
36
+			$this->_destX = floor(($this->_width - $this->_destWidth) / 2);
37 37
 			$this->_destY = floor(($this->_height - $this->_destHeight) / 2);
38 38
 			
39 39
 			// Execute the Crop method with the given parameters
Please login to merge, or discard this patch.
src/images/ImageResizer.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 				}
46 46
 				return $returnFileNames;
47 47
 			} else {
48
-				throw new \Exception('Image doesnt exist: ' . $imagePath);
48
+				throw new \Exception('Image doesnt exist: '.$imagePath);
49 49
 			}
50 50
 		}
51 51
 
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 		 * @return string
57 57
 		 * @throws \Exception
58 58
 		 */
59
-		public function resize($imagePath='', $width='',$height='')
59
+		public function resize($imagePath = '', $width = '', $height = '')
60 60
 		{
61
-			$modifier = '-r' . $width . 'x' . $height;
62
-			return $this->applyMethod('Resize', $imagePath, $width,$height, $modifier);
61
+			$modifier = '-r'.$width.'x'.$height;
62
+			return $this->applyMethod('Resize', $imagePath, $width, $height, $modifier);
63 63
 		}
64 64
 
65 65
 		/**
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 		 * @return string
70 70
 		 * @throws \Exception
71 71
 		 */
72
-		public function smartcrop($imagePath='', $width='',$height='')
72
+		public function smartcrop($imagePath = '', $width = '', $height = '')
73 73
 		{
74
-			$modifier = '-s' . $width . 'x' . $height;
75
-			return $this->applyMethod('SmartCrop', $imagePath, $width,$height, $modifier);
74
+			$modifier = '-s'.$width.'x'.$height;
75
+			return $this->applyMethod('SmartCrop', $imagePath, $width, $height, $modifier);
76 76
 		}
77 77
 
78 78
 		/**
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 		 * @return string
83 83
 		 * @throws \Exception
84 84
 		 */
85
-		public function boxcrop($imagePath='', $width='',$height='')
85
+		public function boxcrop($imagePath = '', $width = '', $height = '')
86 86
 		{
87
-			$modifier = '-b' . $width . 'x' . $height;
88
-			return $this->applyMethod('BoxCrop', $imagePath, $width,$height, $modifier);
87
+			$modifier = '-b'.$width.'x'.$height;
88
+			return $this->applyMethod('BoxCrop', $imagePath, $width, $height, $modifier);
89 89
 		}
90 90
 
91 91
 		/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		 *
95 95
 		 * @return string
96 96
 		 */
97
-		private function modifyName($imagePath, $modifier='')
97
+		private function modifyName($imagePath, $modifier = '')
98 98
 		{
99 99
 			$filename = basename($imagePath);
100 100
 			$path = dirname($imagePath);
@@ -104,30 +104,30 @@  discard block
 block discarded – undo
104 104
 				array_pop($fileParts);
105 105
 				$fileNameWithoutExtension = implode('-', $fileParts);
106 106
 				$fileNameWithoutExtension = StringUtil::slugify($fileNameWithoutExtension);
107
-				$filename = $fileNameWithoutExtension . $modifier  . '.' . $extension;
107
+				$filename = $fileNameWithoutExtension.$modifier.'.'.$extension;
108 108
 			} else {
109 109
 				$filename = StringUtil::slugify($filename);
110 110
 			}
111 111
 
112
-			if (file_exists($path . '/' . $filename)) {
112
+			if (file_exists($path.'/'.$filename)) {
113 113
 				$fileParts = explode('.', $filename);
114 114
 				if (count($fileParts) > 1) {
115 115
 					$extension = end($fileParts);
116 116
 					array_pop($fileParts);
117 117
 					$fileNameWithoutExtension = implode('-', $fileParts);
118 118
 					$fileNameWithoutExtension .= '-copy';
119
-					$filename = $fileNameWithoutExtension . '.' . $extension;
119
+					$filename = $fileNameWithoutExtension.'.'.$extension;
120 120
 				} else {
121 121
 					$filename .= '-copy';
122 122
 				}
123
-				return $this->modifyName($path . '/' . $filename);
123
+				return $this->modifyName($path.'/'.$filename);
124 124
 			}
125
-			return $path . '/' . $filename;
125
+			return $path.'/'.$filename;
126 126
 		}
127 127
 
128 128
 		private function applyMethod($method, $imagePath, $width, $height, $modifier)
129 129
 		{
130
-			$method = 'CloudControl\Cms\\images\\methods\\' . $method;
130
+			$method = 'CloudControl\Cms\\images\\methods\\'.$method;
131 131
 			$destination = $this->modifyName($imagePath, $modifier);
132 132
 			if (file_exists($imagePath)) {
133 133
 				$image = new Image();
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 				$resizedImage->saveImage($destination, $resizedImage->getImageMimeType($imagePath), 80);
142 142
 				return basename($destination);
143 143
 			} else {
144
-				throw new \Exception('Image doesnt exist: ' . $imagePath);
144
+				throw new \Exception('Image doesnt exist: '.$imagePath);
145 145
 			}
146 146
 		}
147 147
 	}
Please login to merge, or discard this patch.