Passed
Push — develop ( ca5759...96efe9 )
by Jens
02:44
created
src/components/cms/FilesRouting.php 1 patch
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.
src/components/FormComponent.php 1 patch
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.
src/images/Image.php 1 patch
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.
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.
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -11,124 +11,124 @@
 block discarded – undo
11 11
 
12 12
 class ImagesStorage extends AbstractStorage
13 13
 {
14
-    protected $imagesDir;
15
-
16
-    public function __construct($repository, $imagesDir)
17
-    {
18
-        parent::__construct($repository);
19
-        $this->imagesDir = $imagesDir;
20
-    }
21
-
22
-
23
-    /**
24
-     * @var ImageSetStorage
25
-     */
26
-    protected $imageSet;
27
-
28
-    /**
29
-     * Get all images
30
-     *
31
-     * @return array
32
-     */
33
-    public function getImages()
34
-    {
35
-        return $this->repository->images;
36
-    }
37
-
38
-    /**
39
-     * @param $postValues
40
-     *
41
-     * @throws \Exception
42
-     */
43
-    public function addImage($postValues)
44
-    {
45
-        $destinationPath = $this->getDestinationPath();
46
-
47
-        $filename = $this->validateFilename($postValues['name'], $destinationPath);
48
-        $destination = $destinationPath . DIRECTORY_SEPARATOR . $filename;
49
-
50
-        if ($postValues['error'] != '0') {
51
-            throw new \Exception('Error uploading file. Error code: ' . $postValues['error']);
52
-        }
53
-
54
-        if (move_uploaded_file($postValues['tmp_name'], $destination)) {
55
-            $imageResizer = new ImageResizer($this->getImageSet()->getImageSet());
56
-            $fileNames = $imageResizer->applyImageSetToImage($destination);
57
-            $fileNames['original'] = $filename;
58
-            $imageObject = ImageFactory::createImageFromPostValues($postValues, $filename, $fileNames);
59
-
60
-            $images = $this->repository->images;
61
-            $images[] = $imageObject;
62
-            $this->repository->images = $images;
63
-
64
-            $this->save();
65
-        } else {
66
-            throw new \Exception('Error moving uploaded file');
67
-        }
68
-    }
69
-
70
-    /**
71
-     * Delete image by name
72
-     * @param $filename
73
-     */
74
-    public function deleteImageByName($filename)
75
-    {
76
-        $destinationPath = $this->getDestinationPath();
77
-
78
-        $images = $this->getImages();
79
-
80
-        foreach ($images as $key => $image) {
81
-            if ($image->file == $filename) {
82
-                foreach ($image->set as $imageSetFilename) {
83
-                    $destination = $destinationPath . '/' . $imageSetFilename;
84
-                    if (file_exists($destination)) {
85
-                        unlink($destination);
86
-                    } else {
87
-                        dump($destination);
88
-                    }
89
-                }
90
-                unset($images[$key]);
91
-            }
92
-        }
93
-
94
-        $this->repository->images = $images;
95
-        $this->save();
96
-    }
97
-
98
-    /**
99
-     * @param $filename
100
-     *
101
-     * @return null
102
-     */
103
-    public function getImageByName($filename)
104
-    {
105
-        $images = $this->getImages();
106
-        foreach ($images as $image) {
107
-            if ($image->file == $filename) {
108
-                return $image;
109
-            }
110
-        }
111
-
112
-        return null;
113
-    }
114
-
115
-    /**
116
-     * @return \CloudControl\Cms\storage\storage\ImageSetStorage
117
-     */
118
-    private function getImageSet()
119
-    {
120
-        if (!$this->imageSet instanceof ImageSetStorage) {
121
-            $this->imageSet = new ImageSetStorage($this->repository);
122
-        }
123
-        return $this->imageSet;
124
-    }
125
-
126
-    /**
127
-     * @return bool|string
128
-     */
129
-    private function getDestinationPath()
130
-    {
131
-        $destinationPath = realpath($this->imagesDir . DIRECTORY_SEPARATOR);
132
-        return $destinationPath;
133
-    }
14
+	protected $imagesDir;
15
+
16
+	public function __construct($repository, $imagesDir)
17
+	{
18
+		parent::__construct($repository);
19
+		$this->imagesDir = $imagesDir;
20
+	}
21
+
22
+
23
+	/**
24
+	 * @var ImageSetStorage
25
+	 */
26
+	protected $imageSet;
27
+
28
+	/**
29
+	 * Get all images
30
+	 *
31
+	 * @return array
32
+	 */
33
+	public function getImages()
34
+	{
35
+		return $this->repository->images;
36
+	}
37
+
38
+	/**
39
+	 * @param $postValues
40
+	 *
41
+	 * @throws \Exception
42
+	 */
43
+	public function addImage($postValues)
44
+	{
45
+		$destinationPath = $this->getDestinationPath();
46
+
47
+		$filename = $this->validateFilename($postValues['name'], $destinationPath);
48
+		$destination = $destinationPath . DIRECTORY_SEPARATOR . $filename;
49
+
50
+		if ($postValues['error'] != '0') {
51
+			throw new \Exception('Error uploading file. Error code: ' . $postValues['error']);
52
+		}
53
+
54
+		if (move_uploaded_file($postValues['tmp_name'], $destination)) {
55
+			$imageResizer = new ImageResizer($this->getImageSet()->getImageSet());
56
+			$fileNames = $imageResizer->applyImageSetToImage($destination);
57
+			$fileNames['original'] = $filename;
58
+			$imageObject = ImageFactory::createImageFromPostValues($postValues, $filename, $fileNames);
59
+
60
+			$images = $this->repository->images;
61
+			$images[] = $imageObject;
62
+			$this->repository->images = $images;
63
+
64
+			$this->save();
65
+		} else {
66
+			throw new \Exception('Error moving uploaded file');
67
+		}
68
+	}
69
+
70
+	/**
71
+	 * Delete image by name
72
+	 * @param $filename
73
+	 */
74
+	public function deleteImageByName($filename)
75
+	{
76
+		$destinationPath = $this->getDestinationPath();
77
+
78
+		$images = $this->getImages();
79
+
80
+		foreach ($images as $key => $image) {
81
+			if ($image->file == $filename) {
82
+				foreach ($image->set as $imageSetFilename) {
83
+					$destination = $destinationPath . '/' . $imageSetFilename;
84
+					if (file_exists($destination)) {
85
+						unlink($destination);
86
+					} else {
87
+						dump($destination);
88
+					}
89
+				}
90
+				unset($images[$key]);
91
+			}
92
+		}
93
+
94
+		$this->repository->images = $images;
95
+		$this->save();
96
+	}
97
+
98
+	/**
99
+	 * @param $filename
100
+	 *
101
+	 * @return null
102
+	 */
103
+	public function getImageByName($filename)
104
+	{
105
+		$images = $this->getImages();
106
+		foreach ($images as $image) {
107
+			if ($image->file == $filename) {
108
+				return $image;
109
+			}
110
+		}
111
+
112
+		return null;
113
+	}
114
+
115
+	/**
116
+	 * @return \CloudControl\Cms\storage\storage\ImageSetStorage
117
+	 */
118
+	private function getImageSet()
119
+	{
120
+		if (!$this->imageSet instanceof ImageSetStorage) {
121
+			$this->imageSet = new ImageSetStorage($this->repository);
122
+		}
123
+		return $this->imageSet;
124
+	}
125
+
126
+	/**
127
+	 * @return bool|string
128
+	 */
129
+	private function getDestinationPath()
130
+	{
131
+		$destinationPath = realpath($this->imagesDir . DIRECTORY_SEPARATOR);
132
+		return $destinationPath;
133
+	}
134 134
 }
135 135
\ No newline at end of file
Please login to merge, or discard this patch.
src/install/_index.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,5 +25,5 @@
 block discarded – undo
25 25
 \CloudControl\Cms\CloudControl::run();
26 26
 
27 27
 if (php_sapi_name() != "cli") {
28
-    ob_end_flush();
28
+	ob_end_flush();
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
src/images/methods/Watermark.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 namespace CloudControl\Cms\images\methods
13 13
 {
14 14
 
15
-    use CloudControl\Cms\images\Image;
16
-    use CloudControl\Cms\images\IMethod;
15
+	use CloudControl\Cms\images\Image;
16
+	use CloudControl\Cms\images\IMethod;
17 17
 
18
-    class Watermark extends IMethod
18
+	class Watermark extends IMethod
19 19
 	{
20 20
 		protected $_x = 0;
21 21
 		protected $_y = 0;
Please login to merge, or discard this patch.
src/images/methods/Crop.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 namespace CloudControl\Cms\images\methods
12 12
 {
13 13
 
14
-    use CloudControl\Cms\images\IMethod;
14
+	use CloudControl\Cms\images\IMethod;
15 15
 
16
-    class Crop extends IMethod
16
+	class Crop extends IMethod
17 17
 	{
18 18
 		protected $_width;
19 19
 		protected $_height;
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 
117 117
 			// Preserve transparency
118 118
 			imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
119
-            imagealphablending($new, false);
120
-            imagesavealpha($new, true);
119
+			imagealphablending($new, false);
120
+			imagesavealpha($new, true);
121 121
 			
122 122
 			imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $this->_destWidth, $this->_destHeight);
123 123
 			
Please login to merge, or discard this patch.
src/images/methods/Resize.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@
 block discarded – undo
11 11
 namespace CloudControl\Cms\images\methods
12 12
 {
13 13
 
14
-    use CloudControl\Cms\images\IMethod;
14
+	use CloudControl\Cms\images\IMethod;
15 15
 
16
-    class Resize extends IMethod
16
+	class Resize extends IMethod
17 17
 	{
18 18
 		protected $_width;
19 19
 		protected $_height;
Please login to merge, or discard this patch.
src/images/methods/SmartCrop.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@
 block discarded – undo
62 62
 
63 63
 			// Preserve transparency
64 64
 			imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
65
-            imagealphablending($new, false);
66
-            imagesavealpha($new, true);
65
+			imagealphablending($new, false);
66
+			imagesavealpha($new, true);
67 67
 			
68 68
 			imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $originalWidth, $originalHeight);
69 69
 			
Please login to merge, or discard this patch.