Passed
Branch develop (96efe9)
by Jens
02:38
created
src/CloudControl.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
         $event->getIO()->write("");
41 41
 
42 42
         $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir');
43
-        $rootDir = realpath($vendorDir . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
43
+        $rootDir = realpath($vendorDir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR);
44 44
 
45
-        $baseConfigTargetPath = $rootDir . DIRECTORY_SEPARATOR . 'config.json';
45
+        $baseConfigTargetPath = $rootDir.DIRECTORY_SEPARATOR.'config.json';
46 46
         $configObject = self::getConfig($event, $baseConfigTargetPath);
47 47
 
48 48
         $configObject->{'vendorDir'} = realpath($vendorDir);
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
         $configObject->{'templateDir'} = self::createDir($event, $rootDir, 'templates');
51 51
         $configObject->{'storageDir'} = self::createDir($event, $rootDir, $configObject->{'storageDir'});
52 52
         $configObject->{'publicDir'} = self::createDir($event, $rootDir, 'public');
53
-        $configObject->{'jsDir'} = self::createDir($event, $rootDir, $configObject->{'publicDir'} . 'js');
54
-        $configObject->{'cssDir'} = self::createDir($event, $rootDir, $configObject->{'publicDir'} . 'css');
55
-        $configObject->{'imagesDir'} = self::createDir($event, $rootDir, $configObject->{'publicDir'} . 'images');
56
-        $configObject->{'filesDir'} = self::createDir($event, $rootDir, $configObject->{'publicDir'} . 'files');
53
+        $configObject->{'jsDir'} = self::createDir($event, $rootDir, $configObject->{'publicDir'}.'js');
54
+        $configObject->{'cssDir'} = self::createDir($event, $rootDir, $configObject->{'publicDir'}.'css');
55
+        $configObject->{'imagesDir'} = self::createDir($event, $rootDir, $configObject->{'publicDir'}.'images');
56
+        $configObject->{'filesDir'} = self::createDir($event, $rootDir, $configObject->{'publicDir'}.'files');
57 57
 
58
-        $baseStorageDefaultPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.json';
59
-        $baseStorageSqlPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.sql';
58
+        $baseStorageDefaultPath = __DIR__.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR.'_storage.json';
59
+        $baseStorageSqlPath = __DIR__.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR.'_storage.sql';
60 60
 
61 61
         self::createStorage($configObject->{'storageDir'}, $baseStorageDefaultPath, $baseStorageSqlPath);
62 62
         self::saveConfig($event, $baseConfigTargetPath, $configObject);
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
     private static function saveConfig(Event $event, $baseConfigTargetPath, $configObject)
88 88
     {
89 89
         file_put_contents($baseConfigTargetPath, json_encode($configObject));
90
-        $event->getIO()->write("[INFO] Saved config to: " . $baseConfigTargetPath);
90
+        $event->getIO()->write("[INFO] Saved config to: ".$baseConfigTargetPath);
91 91
     }
92 92
 
93 93
     private static function copyInstallFile(Event $event, $sourceFileName, $destinationPath, $destinationFileName = null)
94 94
     {
95
-        $sourceFilePath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_' . $sourceFileName);
95
+        $sourceFilePath = realpath(__DIR__.DIRECTORY_SEPARATOR.'install/_'.$sourceFileName);
96 96
 
97 97
 
98 98
         if ($destinationFileName === null) {
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
         }
101 101
 
102 102
         if (file_exists($sourceFilePath) && realpath($destinationPath) !== false) {
103
-            $destinationFullPath = realpath($destinationPath) . DIRECTORY_SEPARATOR . $destinationFileName;
103
+            $destinationFullPath = realpath($destinationPath).DIRECTORY_SEPARATOR.$destinationFileName;
104 104
             if (file_exists($destinationFullPath)) {
105
-                $event->getIO()->write("[INFO] File already exists: " . $destinationFullPath);
105
+                $event->getIO()->write("[INFO] File already exists: ".$destinationFullPath);
106 106
             } else {
107 107
                 copy($sourceFilePath, $destinationFullPath);
108
-                $event->getIO()->write("[INSTALL] Copied file: " . $sourceFileName . ' to ' . $destinationPath);
108
+                $event->getIO()->write("[INSTALL] Copied file: ".$sourceFileName.' to '.$destinationPath);
109 109
             }
110 110
         } else {
111
-            $event->getIO()->write("[ERROR] Couldnt copy file: " . $sourceFileName . ' to ' . $destinationPath);
111
+            $event->getIO()->write("[ERROR] Couldnt copy file: ".$sourceFileName.' to '.$destinationPath);
112 112
         }
113 113
     }
114 114
 
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 
126 126
     private static function createDir(Event $event, $rootDir, $dirName)
127 127
     {
128
-        $dir = $rootDir . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR;
128
+        $dir = $rootDir.DIRECTORY_SEPARATOR.$dirName.DIRECTORY_SEPARATOR;
129 129
         if (!is_dir($dir)) {
130 130
             mkdir($dir);
131
-            $event->getIO()->write("[INSTALL] Created dir: " . $dir);
131
+            $event->getIO()->write("[INSTALL] Created dir: ".$dir);
132 132
         } else {
133
-            $event->getIO()->write("[INFO] Dir already exists: " . $dir);
133
+            $event->getIO()->write("[INFO] Dir already exists: ".$dir);
134 134
         }
135 135
         return self::getRelativePath($rootDir, $dir);
136 136
     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      */
142 142
     private static function getConfig(Event $event, $configTargetPath)
143 143
     {
144
-        $baseConfigDefaultPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_config.json');
144
+        $baseConfigDefaultPath = realpath(__DIR__.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR.'_config.json');
145 145
 
146 146
         if (file_exists($configTargetPath)) {
147 147
             $config = json_decode(file_get_contents($configTargetPath));
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
     private static function getRelativePath($from, $to)
165 165
     {
166 166
         // some compatibility fixes for Windows paths
167
-        $from = is_dir($from) ? rtrim($from, '\/') . DIRECTORY_SEPARATOR : $from;
168
-        $to = is_dir($to) ? rtrim($to, '\/') . DIRECTORY_SEPARATOR : $to;
167
+        $from = is_dir($from) ? rtrim($from, '\/').DIRECTORY_SEPARATOR : $from;
168
+        $to = is_dir($to) ? rtrim($to, '\/').DIRECTORY_SEPARATOR : $to;
169 169
         $from = str_replace('\\', DIRECTORY_SEPARATOR, $from);
170 170
         $to = str_replace('\\', DIRECTORY_SEPARATOR, $to);
171 171
 
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
      */
186 186
     private static function removePointerToCurrentDir($relPath)
187 187
     {
188
-        while (strpos($relPath, '.' . DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR) !== false) {
189
-            $relPath = str_replace('.' . DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR, '.' . DIRECTORY_SEPARATOR, $relPath);
188
+        while (strpos($relPath, '.'.DIRECTORY_SEPARATOR.'.'.DIRECTORY_SEPARATOR) !== false) {
189
+            $relPath = str_replace('.'.DIRECTORY_SEPARATOR.'.'.DIRECTORY_SEPARATOR, '.'.DIRECTORY_SEPARATOR, $relPath);
190 190
         }
191 191
         return $relPath;
192 192
     }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
                     $relPath = array_pad($relPath, $padLength, '..');
214 214
                     break;
215 215
                 } else {
216
-                    $relPath[0] = '.' . DIRECTORY_SEPARATOR . $relPath[0];
216
+                    $relPath[0] = '.'.DIRECTORY_SEPARATOR.$relPath[0];
217 217
                 }
218 218
             }
219 219
         }
Please login to merge, or discard this patch.
src/util/functions.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 {
12 12
     $debug_backtrace = current(debug_backtrace());
13 13
     if (PHP_SAPI == 'cli') {
14
-        echo 'Dump: ' . $debug_backtrace['file'] . ':' . $debug_backtrace['line'] . "\n";
14
+        echo 'Dump: '.$debug_backtrace['file'].':'.$debug_backtrace['line']."\n";
15 15
         foreach (func_get_args() as $data) {
16 16
             var_dump($data);
17 17
         }
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 <body>
30 30
 END;
31 31
 
32
-        echo '<div>Dump: ' . $debug_backtrace['file'] . ':<b>' . $debug_backtrace['line'] . "</b></div>";
32
+        echo '<div>Dump: '.$debug_backtrace['file'].':<b>'.$debug_backtrace['line']."</b></div>";
33 33
         echo '<pre>';
34 34
         foreach (func_get_args() as $data) {
35 35
             echo "<code>";
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 {
56 56
     if (!isset($_GET['unsanitized'])) {
57 57
         $search = array(
58
-            '/\>[^\S ]+/s',     // strip whitespaces after tags, except space
59
-            '/[^\S ]+\</s',     // strip whitespaces before tags, except space
60
-            '/(\s)+/s',         // shorten multiple whitespace sequences
58
+            '/\>[^\S ]+/s', // strip whitespaces after tags, except space
59
+            '/[^\S ]+\</s', // strip whitespaces before tags, except space
60
+            '/(\s)+/s', // shorten multiple whitespace sequences
61 61
             '/<!--(.|\s)*?-->/' // Remove HTML comments
62 62
         );
63 63
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
  */
86 86
 function utf8Convert($array)
87 87
 {
88
-    array_walk_recursive($array, function (&$item) {
88
+    array_walk_recursive($array, function(&$item) {
89 89
         if (!mb_detect_encoding($item, 'utf-8', true)) {
90 90
             $item = utf8_encode($item);
91 91
         }
Please login to merge, or discard this patch.
src/images/IMethod.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@
 block discarded – undo
10 10
  
11 11
 namespace CloudControl\Cms\images
12 12
 {
13
-	abstract class IMethod
14
-	{
15
-		/**
16
-		 * Method stub, use for executing the manipulation
17
-		 * 
18
-		 * @param  resource $imageResource
19
-		 * @return resource
20
-		 */
21
-		abstract public function Execute($imageResource);
22
-	}
13
+    abstract class IMethod
14
+    {
15
+        /**
16
+         * Method stub, use for executing the manipulation
17
+         * 
18
+         * @param  resource $imageResource
19
+         * @return resource
20
+         */
21
+        abstract public function Execute($imageResource);
22
+    }
23 23
 }
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
src/images/methods/Watermark.php 2 patches
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -16,174 +16,174 @@
 block discarded – undo
16 16
     use CloudControl\Cms\images\IMethod;
17 17
 
18 18
     class Watermark extends IMethod
19
-	{
20
-		protected $_x = 0;
21
-		protected $_y = 0;
22
-		protected $_transparency = 100;
19
+    {
20
+        protected $_x = 0;
21
+        protected $_y = 0;
22
+        protected $_transparency = 100;
23 23
 		
24
-		/**
25
-		 * @var Image
26
-		 */
27
-		protected $_watermark;
24
+        /**
25
+         * @var Image
26
+         */
27
+        protected $_watermark;
28 28
 	
29
-		protected function init()
30
-		{}
29
+        protected function init()
30
+        {}
31 31
 		
32
-		/**
33
-		 * Sets transparency for watermark
34
-		 *
35
-		 * @param  int $transparency
36
-		 * @return self
37
-		 */
38
-		public function SetTransparency($transparency)
39
-		{
40
-			$this->_transparency = intval($transparency);
41
-			return $this;
42
-		}
32
+        /**
33
+         * Sets transparency for watermark
34
+         *
35
+         * @param  int $transparency
36
+         * @return self
37
+         */
38
+        public function SetTransparency($transparency)
39
+        {
40
+            $this->_transparency = intval($transparency);
41
+            return $this;
42
+        }
43 43
 		
44
-		/**
45
-		 * Use build-in logic to position the watermark
46
-		 *
47
-		 * @param 	string $x
48
-		 * @param 	string $y
49
-		 * @return 	self
50
-		 */
51
-		public function SetPosition($x, $y)
52
-		{
53
-			$this->SetX($x);
54
-			$this->SetY($y);
55
-			return $this;
56
-		}
44
+        /**
45
+         * Use build-in logic to position the watermark
46
+         *
47
+         * @param 	string $x
48
+         * @param 	string $y
49
+         * @return 	self
50
+         */
51
+        public function SetPosition($x, $y)
52
+        {
53
+            $this->SetX($x);
54
+            $this->SetY($y);
55
+            return $this;
56
+        }
57 57
 		
58
-		/**
59
-		 * Use build-in logic to position the x of watermark
60
-		 *
61
-		 * @param 	resource $imageResource
62
-		 * @return 	self
63
-		 */
64
-		protected function calculateX($imageResource)
65
-		{
66
-			if (intval($this->_x) === $this->_x) return $this->_x;
58
+        /**
59
+         * Use build-in logic to position the x of watermark
60
+         *
61
+         * @param 	resource $imageResource
62
+         * @return 	self
63
+         */
64
+        protected function calculateX($imageResource)
65
+        {
66
+            if (intval($this->_x) === $this->_x) return $this->_x;
67 67
 			
68
-			$x = strtolower($this->_x);
68
+            $x = strtolower($this->_x);
69 69
 			
70
-			$imageWidth = imagesx($imageResource);
71
-			$watermarkWidth = imagesx($this->GetWatermark()->getImageResource());
70
+            $imageWidth = imagesx($imageResource);
71
+            $watermarkWidth = imagesx($this->GetWatermark()->getImageResource());
72 72
 			
73
-			if ($x == 'left') {
74
-				$x = 0;
75
-			} elseif ($x == 'center') {
76
-				$x = $imageWidth / 2 - ($watermarkWidth / 2);
77
-			} elseif ($x == 'right') {
78
-				$x = $imageWidth - $watermarkWidth;
79
-			}
80
-			return intval($x);
81
-		}
73
+            if ($x == 'left') {
74
+                $x = 0;
75
+            } elseif ($x == 'center') {
76
+                $x = $imageWidth / 2 - ($watermarkWidth / 2);
77
+            } elseif ($x == 'right') {
78
+                $x = $imageWidth - $watermarkWidth;
79
+            }
80
+            return intval($x);
81
+        }
82 82
 		
83
-		/**
84
-		 * Use build-in logic to position the y of watermark
85
-		 *
86
-		 * @param 	resource $imageResource
87
-		 * @return 	self
88
-		 */
89
-		public function calculateY($imageResource)
90
-		{
91
-			if (intval($this->_y) === $this->_y) return $this->_y;
83
+        /**
84
+         * Use build-in logic to position the y of watermark
85
+         *
86
+         * @param 	resource $imageResource
87
+         * @return 	self
88
+         */
89
+        public function calculateY($imageResource)
90
+        {
91
+            if (intval($this->_y) === $this->_y) return $this->_y;
92 92
 		
93
-			$y = strtolower($this->_y);
93
+            $y = strtolower($this->_y);
94 94
 			
95
-			$imageHeight = imagesy($imageResource);
96
-			$watermarkHeight = imagesy($this->GetWatermark()->getImageResource());
95
+            $imageHeight = imagesy($imageResource);
96
+            $watermarkHeight = imagesy($this->GetWatermark()->getImageResource());
97 97
 			
98
-			if ($y == 'top') {
99
-				$y = 0;
100
-			} elseif ($y == 'center') {
101
-				$y = $imageHeight / 2 - ($watermarkHeight / 2);
102
-			} elseif ($y == 'bottom') {
103
-				$y = $imageHeight - $watermarkHeight;
104
-			}
105
-			return intval($y);
106
-		}
98
+            if ($y == 'top') {
99
+                $y = 0;
100
+            } elseif ($y == 'center') {
101
+                $y = $imageHeight / 2 - ($watermarkHeight / 2);
102
+            } elseif ($y == 'bottom') {
103
+                $y = $imageHeight - $watermarkHeight;
104
+            }
105
+            return intval($y);
106
+        }
107 107
 
108
-		/**
109
-		 * Sets the image that will be used as watermark
110
-		 *
111
-		 * @param Image $image
112
-		 * @return Watermark
113
-		 */
114
-		public function SetWatermark(Image $image)
115
-		{
116
-			$this->_watermark = $image;
117
-			return $this;
118
-		}
108
+        /**
109
+         * Sets the image that will be used as watermark
110
+         *
111
+         * @param Image $image
112
+         * @return Watermark
113
+         */
114
+        public function SetWatermark(Image $image)
115
+        {
116
+            $this->_watermark = $image;
117
+            return $this;
118
+        }
119 119
 
120
-		/**
121
-		 * Returns the watermark.
122
-		 * Throws an Exception if it's not set or if it's not an \CloudControl\Cms\image\Image
123
-		 * @return \images\Image
124
-		 * @throws \Exception
125
-		 */
126
-		public function GetWatermark()
127
-		{
128
-			if ($this->_watermark == null) throw new \Exception('A watermark is not set. Please supply a \CloudControl\Cms\image\Image using $this->SetWatermark');
129
-			return $this->_watermark;
130
-		}
120
+        /**
121
+         * Returns the watermark.
122
+         * Throws an Exception if it's not set or if it's not an \CloudControl\Cms\image\Image
123
+         * @return \images\Image
124
+         * @throws \Exception
125
+         */
126
+        public function GetWatermark()
127
+        {
128
+            if ($this->_watermark == null) throw new \Exception('A watermark is not set. Please supply a \CloudControl\Cms\image\Image using $this->SetWatermark');
129
+            return $this->_watermark;
130
+        }
131 131
 		
132
-		/**
133
-		 * Set the x
134
-		 *
135
-		 * @param  int | string $x
136
-		 * @return self
137
-		 */
138
-		public function SetX($x)
139
-		{
140
-			$this->_x = $x;
141
-			return $this;
142
-		}
132
+        /**
133
+         * Set the x
134
+         *
135
+         * @param  int | string $x
136
+         * @return self
137
+         */
138
+        public function SetX($x)
139
+        {
140
+            $this->_x = $x;
141
+            return $this;
142
+        }
143 143
 		
144
-		/**
145
-		 * Set the y
146
-		 *
147
-		 * @param  int | string $y
148
-		 * @return self
149
-		 */
150
-		public function SetY($y)
151
-		{
152
-			$this->_y = $y;
153
-			return $this;
154
-		}
144
+        /**
145
+         * Set the y
146
+         *
147
+         * @param  int | string $y
148
+         * @return self
149
+         */
150
+        public function SetY($y)
151
+        {
152
+            $this->_y = $y;
153
+            return $this;
154
+        }
155 155
 		
156
-		public function Execute($imageResource)
157
-		{
158
-			$watermark = $this->GetWatermark();
159
-			$watermarkWidth  = imagesx($watermark->getImageResource());
160
-			$watermarkHeight = imagesy($watermark->getImageResource());
156
+        public function Execute($imageResource)
157
+        {
158
+            $watermark = $this->GetWatermark();
159
+            $watermarkWidth  = imagesx($watermark->getImageResource());
160
+            $watermarkHeight = imagesy($watermark->getImageResource());
161 161
 			
162
-			$x = $this->calculateX($imageResource);
163
-			$y = $this->calculateY($imageResource);
162
+            $x = $this->calculateX($imageResource);
163
+            $y = $this->calculateY($imageResource);
164 164
 			
165
-			$imageWidth = imagesx($imageResource);
166
-			$imageHeight = imagesy($imageResource);
165
+            $imageWidth = imagesx($imageResource);
166
+            $imageHeight = imagesy($imageResource);
167 167
 			
168
-			$new = imagecreatetruecolor($imageWidth, $imageHeight);
168
+            $new = imagecreatetruecolor($imageWidth, $imageHeight);
169 169
 			
170
-			// Preserve transparency of the image
171
-			imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
172
-			imagealphablending($new, false);
173
-			imagesavealpha($new, true);
170
+            // Preserve transparency of the image
171
+            imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
172
+            imagealphablending($new, false);
173
+            imagesavealpha($new, true);
174 174
 			
175
-			// Preserve transparency of the watermark
176
-			imagecolortransparent($watermark->getImageResource(), imagecolorallocatealpha($watermark->getImageResource(), 0, 0, 0, 127));
177
-			imagealphablending($watermark->getImageResource(), false);
178
-			imagesavealpha($watermark->getImageResource(), true);
175
+            // Preserve transparency of the watermark
176
+            imagecolortransparent($watermark->getImageResource(), imagecolorallocatealpha($watermark->getImageResource(), 0, 0, 0, 127));
177
+            imagealphablending($watermark->getImageResource(), false);
178
+            imagesavealpha($watermark->getImageResource(), true);
179 179
 			
180
-			imagealphablending($new, true);
181
-			imagealphablending($watermark->getImageResource(), true);
180
+            imagealphablending($new, true);
181
+            imagealphablending($watermark->getImageResource(), true);
182 182
 			
183
-			imagecopy($new, $imageResource, 0, 0, 0, 0, $imageWidth, $imageHeight);
184
-			imagecopymerge($new, $watermark->getImageResource(), $x, $y, 0, 0, $watermarkWidth, $watermarkHeight, $this->_transparency);
183
+            imagecopy($new, $imageResource, 0, 0, 0, 0, $imageWidth, $imageHeight);
184
+            imagecopymerge($new, $watermark->getImageResource(), $x, $y, 0, 0, $watermarkWidth, $watermarkHeight, $this->_transparency);
185 185
 			
186
-			return $new;
187
-		}
188
-	}
186
+            return $new;
187
+        }
188
+    }
189 189
 }
190 190
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@  discard block
 block discarded – undo
63 63
 		 */
64 64
 		protected function calculateX($imageResource)
65 65
 		{
66
-			if (intval($this->_x) === $this->_x) return $this->_x;
66
+			if (intval($this->_x) === $this->_x) {
67
+			    return $this->_x;
68
+			}
67 69
 			
68 70
 			$x = strtolower($this->_x);
69 71
 			
@@ -88,7 +90,9 @@  discard block
 block discarded – undo
88 90
 		 */
89 91
 		public function calculateY($imageResource)
90 92
 		{
91
-			if (intval($this->_y) === $this->_y) return $this->_y;
93
+			if (intval($this->_y) === $this->_y) {
94
+			    return $this->_y;
95
+			}
92 96
 		
93 97
 			$y = strtolower($this->_y);
94 98
 			
@@ -125,7 +129,9 @@  discard block
 block discarded – undo
125 129
 		 */
126 130
 		public function GetWatermark()
127 131
 		{
128
-			if ($this->_watermark == null) throw new \Exception('A watermark is not set. Please supply a \CloudControl\Cms\image\Image using $this->SetWatermark');
132
+			if ($this->_watermark == null) {
133
+			    throw new \Exception('A watermark is not set. Please supply a \CloudControl\Cms\image\Image using $this->SetWatermark');
134
+			}
129 135
 			return $this->_watermark;
130 136
 		}
131 137
 		
Please login to merge, or discard this patch.
src/images/methods/Crop.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -14,114 +14,114 @@
 block discarded – undo
14 14
     use CloudControl\Cms\images\IMethod;
15 15
 
16 16
     class Crop extends IMethod
17
-	{
18
-		protected $_width;
19
-		protected $_height;
20
-		protected $_x;
21
-		protected $_y;
17
+    {
18
+        protected $_width;
19
+        protected $_height;
20
+        protected $_x;
21
+        protected $_y;
22 22
 		
23
-		protected $_destWidth;
24
-		protected $_destHeight;
25
-		protected $_destX = 0.0;
26
-		protected $_destY = 0.0;
23
+        protected $_destWidth;
24
+        protected $_destHeight;
25
+        protected $_destX = 0.0;
26
+        protected $_destY = 0.0;
27 27
 
28
-		/**
29
-		 * @var null|array
30
-		 */
31
-		protected $_backgroundColor = null;
28
+        /**
29
+         * @var null|array
30
+         */
31
+        protected $_backgroundColor = null;
32 32
 	
33
-		public function init()
34
-		{}
33
+        public function init()
34
+        {}
35 35
 		
36
-		/**
37
-		 * Set the width
38
-		 *
39
-		 * @param  int $width
40
-		 * @return self
41
-		 */
42
-		public function SetWidth($width)
43
-		{
44
-			$this->_width = intval($width);
45
-			$this->_destWidth = intval($width);
46
-			return $this;
47
-		}
36
+        /**
37
+         * Set the width
38
+         *
39
+         * @param  int $width
40
+         * @return self
41
+         */
42
+        public function SetWidth($width)
43
+        {
44
+            $this->_width = intval($width);
45
+            $this->_destWidth = intval($width);
46
+            return $this;
47
+        }
48 48
 		
49
-		/**
50
-		 * Set the height
51
-		 *
52
-		 * @param  int $height
53
-		 * @return self
54
-		 */
55
-		public function SetHeight($height)
56
-		{
57
-			$this->_height = intval($height);
58
-			$this->_destHeight = intval($height);
59
-			return $this;
60
-		}
49
+        /**
50
+         * Set the height
51
+         *
52
+         * @param  int $height
53
+         * @return self
54
+         */
55
+        public function SetHeight($height)
56
+        {
57
+            $this->_height = intval($height);
58
+            $this->_destHeight = intval($height);
59
+            return $this;
60
+        }
61 61
 		
62
-		/**
63
-		 * Set the x
64
-		 *
65
-		 * @param  int $x
66
-		 * @return self
67
-		 */
68
-		public function SetX($x)
69
-		{
70
-			$this->_x = $x;
71
-			return $this;
72
-		}
62
+        /**
63
+         * Set the x
64
+         *
65
+         * @param  int $x
66
+         * @return self
67
+         */
68
+        public function SetX($x)
69
+        {
70
+            $this->_x = $x;
71
+            return $this;
72
+        }
73 73
 		
74
-		/**
75
-		 * Set the y
76
-		 *
77
-		 * @param  int $y
78
-		 * @return self
79
-		 */
80
-		public function SetY($y)
81
-		{
82
-			$this->_y = $y;
83
-			return $this;
84
-		}
74
+        /**
75
+         * Set the y
76
+         *
77
+         * @param  int $y
78
+         * @return self
79
+         */
80
+        public function SetY($y)
81
+        {
82
+            $this->_y = $y;
83
+            return $this;
84
+        }
85 85
 
86
-		/**
87
-		 * If neccesary, fill the background color
88
-		 * with this color
89
-		 *
90
-		 * @param int $r Red
91
-		 * @param int $g Green
92
-		 * @param int $b Blue
93
-		 *
94
-		 * @return $this
95
-		 */
96
-		public function FillBackground($r, $g, $b)
97
-		{
98
-			$this->_backgroundColor = array(intval($r), intval($g), intval($b));
99
-			return $this;
100
-		}
86
+        /**
87
+         * If neccesary, fill the background color
88
+         * with this color
89
+         *
90
+         * @param int $r Red
91
+         * @param int $g Green
92
+         * @param int $b Blue
93
+         *
94
+         * @return $this
95
+         */
96
+        public function FillBackground($r, $g, $b)
97
+        {
98
+            $this->_backgroundColor = array(intval($r), intval($g), intval($b));
99
+            return $this;
100
+        }
101 101
 
102
-		/**
103
-		 * @param resource $imageResource
104
-		 *
105
-		 * @return resource
106
-		 */
107
-		public function Execute($imageResource)
108
-		{
109
-			// Create the new image
110
-			$new = imagecreatetruecolor($this->_width, $this->_height);
102
+        /**
103
+         * @param resource $imageResource
104
+         *
105
+         * @return resource
106
+         */
107
+        public function Execute($imageResource)
108
+        {
109
+            // Create the new image
110
+            $new = imagecreatetruecolor($this->_width, $this->_height);
111 111
 			
112
-			if ($this->_backgroundColor !== null) {
113
-				$fill = imagecolorallocate($new, $this->_backgroundColor[0], $this->_backgroundColor[1], $this->_backgroundColor[2]);
114
-				imagefill($new, 0, 0, $fill);
115
-			}
112
+            if ($this->_backgroundColor !== null) {
113
+                $fill = imagecolorallocate($new, $this->_backgroundColor[0], $this->_backgroundColor[1], $this->_backgroundColor[2]);
114
+                imagefill($new, 0, 0, $fill);
115
+            }
116 116
 
117
-			// Preserve transparency
118
-			imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
117
+            // Preserve transparency
118
+            imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
119 119
             imagealphablending($new, false);
120 120
             imagesavealpha($new, true);
121 121
 			
122
-			imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $this->_destWidth, $this->_destHeight);
122
+            imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $this->_destWidth, $this->_destHeight);
123 123
 			
124
-			return $new;
125
-		}
126
-	}
124
+            return $new;
125
+        }
126
+    }
127 127
 }
128 128
\ No newline at end of file
Please login to merge, or discard this patch.
src/images/methods/SmartCrop.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -10,62 +10,62 @@
 block discarded – undo
10 10
  
11 11
 namespace CloudControl\Cms\images\methods
12 12
 {
13
-	class SmartCrop extends Crop
14
-	{
15
-		/**
16
-		 * Use build-in logic to position the smartcrop
17
-		 *
18
-		 * @param 	string $x
19
-		 * @param 	string $y
20
-		 * @return 	self
21
-		 */
22
-		public function SetPosition($x, $y)
23
-		{
24
-			$this->SetX($x);
25
-			$this->SetY($y);
26
-			return $this;
27
-		}
13
+    class SmartCrop extends Crop
14
+    {
15
+        /**
16
+         * Use build-in logic to position the smartcrop
17
+         *
18
+         * @param 	string $x
19
+         * @param 	string $y
20
+         * @return 	self
21
+         */
22
+        public function SetPosition($x, $y)
23
+        {
24
+            $this->SetX($x);
25
+            $this->SetY($y);
26
+            return $this;
27
+        }
28 28
 	
29
-		public function Execute($imageResource)
30
-		{
31
-			// Define the origial width and height
32
-			$originalWidth = imagesx($imageResource);
33
-			$originalHeight = imagesy($imageResource);
29
+        public function Execute($imageResource)
30
+        {
31
+            // Define the origial width and height
32
+            $originalWidth = imagesx($imageResource);
33
+            $originalHeight = imagesy($imageResource);
34 34
 			
35
-			// Define the ratios
36
-			$wRatio = $originalWidth / $this->_width;
37
-			$hRatio = $originalHeight / $this->_height;
35
+            // Define the ratios
36
+            $wRatio = $originalWidth / $this->_width;
37
+            $hRatio = $originalHeight / $this->_height;
38 38
 			
39
-			// Define which ratio will be used, depending on which is the biggest side
40
-			$ratio = $wRatio < $hRatio ? $wRatio : $hRatio;
41
-			if ($ratio < 1) $ratio = 1;
39
+            // Define which ratio will be used, depending on which is the biggest side
40
+            $ratio = $wRatio < $hRatio ? $wRatio : $hRatio;
41
+            if ($ratio < 1) $ratio = 1;
42 42
 			
43
-			// Calculate the destination width, height, x and y
44
-			$this->_destWidth = $originalWidth / $ratio;
45
-			$this->_destHeight = $originalHeight / $ratio;
46
-			$this->_destX = ($this->_width - $this->_destWidth) / 2;
47
-			$this->_destY = ($this->_height - $this->_destHeight) / 2;
43
+            // Calculate the destination width, height, x and y
44
+            $this->_destWidth = $originalWidth / $ratio;
45
+            $this->_destHeight = $originalHeight / $ratio;
46
+            $this->_destX = ($this->_width - $this->_destWidth) / 2;
47
+            $this->_destY = ($this->_height - $this->_destHeight) / 2;
48 48
 			
49
-			// Define the origial width and height
50
-			$originalWidth = imagesx($imageResource);
51
-			$originalHeight = imagesy($imageResource);
49
+            // Define the origial width and height
50
+            $originalWidth = imagesx($imageResource);
51
+            $originalHeight = imagesy($imageResource);
52 52
 			
53
-			// Create the new image
54
-			$new = imagecreatetruecolor($this->_width, $this->_height);
53
+            // Create the new image
54
+            $new = imagecreatetruecolor($this->_width, $this->_height);
55 55
 			
56
-			if ($this->_backgroundColor !== null) {
57
-				$fill = imagecolorallocate($new, $this->_backgroundColor[0], $this->_backgroundColor[1], $this->_backgroundColor[2]);
58
-				imagefill($new, 0, 0, $fill);
59
-			}
56
+            if ($this->_backgroundColor !== null) {
57
+                $fill = imagecolorallocate($new, $this->_backgroundColor[0], $this->_backgroundColor[1], $this->_backgroundColor[2]);
58
+                imagefill($new, 0, 0, $fill);
59
+            }
60 60
 
61
-			// Preserve transparency
62
-			imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
61
+            // Preserve transparency
62
+            imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
63 63
             imagealphablending($new, false);
64 64
             imagesavealpha($new, true);
65 65
 			
66
-			imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $originalWidth, $originalHeight);
66
+            imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $originalWidth, $originalHeight);
67 67
 			
68
-			return $new;
69
-		}
70
-	}
68
+            return $new;
69
+        }
70
+    }
71 71
 }
72 72
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,9 @@
 block discarded – undo
38 38
 			
39 39
 			// Define which ratio will be used, depending on which is the biggest side
40 40
 			$ratio = $wRatio < $hRatio ? $wRatio : $hRatio;
41
-			if ($ratio < 1) $ratio = 1;
41
+			if ($ratio < 1) {
42
+			    $ratio = 1;
43
+			}
42 44
 			
43 45
 			// Calculate the destination width, height, x and y
44 46
 			$this->_destWidth = $originalWidth / $ratio;
Please login to merge, or discard this patch.
src/images/methods/Grayscale.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,18 +12,18 @@
 block discarded – undo
12 12
     use CloudControl\Cms\images\IMethod;
13 13
 
14 14
     class Grayscale extends IMethod
15
-	{		
16
-		public function Execute($imageResource)
17
-		{			
18
-			// Preserve transparency
19
-			imagecolortransparent($imageResource, imagecolorallocatealpha($imageResource, 0, 0, 0, 127));
20
-			imagealphablending($imageResource, false);
21
-			imagesavealpha($imageResource, true);
15
+    {		
16
+        public function Execute($imageResource)
17
+        {			
18
+            // Preserve transparency
19
+            imagecolortransparent($imageResource, imagecolorallocatealpha($imageResource, 0, 0, 0, 127));
20
+            imagealphablending($imageResource, false);
21
+            imagesavealpha($imageResource, true);
22 22
 			
23
-			// Make grayscale
24
-			imagefilter($imageResource, IMG_FILTER_GRAYSCALE);
23
+            // Make grayscale
24
+            imagefilter($imageResource, IMG_FILTER_GRAYSCALE);
25 25
 			
26
-			return $imageResource;
27
-		}
28
-	}
26
+            return $imageResource;
27
+        }
28
+    }
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/SearchComponent.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -14,41 +14,41 @@
 block discarded – undo
14 14
 
15 15
 class SearchComponent extends BaseComponent
16 16
 {
17
-	protected $searchParameterName = 'q';
18
-	protected $searchResultsParameterName = 'searchResults';
19
-
20
-	/**
21
-	 * @param \CloudControl\Cms\storage\Storage $storage
22
-	 */
23
-	public function run(Storage $storage)
24
-	{
25
-		parent::run($storage);
26
-
27
-		$this->checkParameters();
28
-
29
-		$request = $this->request;
30
-		if (isset($request::$get[$this->searchParameterName])) {
31
-			$query = $request::$get[$this->searchParameterName];
32
-			$filteredQuery = new CharacterFilter($query);
33
-			$tokenizer = new Tokenizer($filteredQuery);
34
-			$search = new Search($storage);
35
-			$results = $search->getDocumentsForTokenizer($tokenizer);
36
-			$this->parameters[$this->searchResultsParameterName] = $results;
37
-		}
38
-	}
39
-
40
-	/**
41
-	 * Checks to see if any parameters were defined in the cms and acts according
42
-	 */
43
-	private function checkParameters()
44
-	{
45
-		if (isset($this->parameters['searchParameterName'])) {
46
-			$this->searchParameterName = $this->parameters['searchParameterName'];
47
-		}
48
-
49
-		if (isset($this->parameters['searchResultsParameterName'])) {
50
-			$this->searchParameterName = $this->parameters['searchResultsParameterName'];
51
-		}
52
-	}
17
+    protected $searchParameterName = 'q';
18
+    protected $searchResultsParameterName = 'searchResults';
19
+
20
+    /**
21
+     * @param \CloudControl\Cms\storage\Storage $storage
22
+     */
23
+    public function run(Storage $storage)
24
+    {
25
+        parent::run($storage);
26
+
27
+        $this->checkParameters();
28
+
29
+        $request = $this->request;
30
+        if (isset($request::$get[$this->searchParameterName])) {
31
+            $query = $request::$get[$this->searchParameterName];
32
+            $filteredQuery = new CharacterFilter($query);
33
+            $tokenizer = new Tokenizer($filteredQuery);
34
+            $search = new Search($storage);
35
+            $results = $search->getDocumentsForTokenizer($tokenizer);
36
+            $this->parameters[$this->searchResultsParameterName] = $results;
37
+        }
38
+    }
39
+
40
+    /**
41
+     * Checks to see if any parameters were defined in the cms and acts according
42
+     */
43
+    private function checkParameters()
44
+    {
45
+        if (isset($this->parameters['searchParameterName'])) {
46
+            $this->searchParameterName = $this->parameters['searchParameterName'];
47
+        }
48
+
49
+        if (isset($this->parameters['searchResultsParameterName'])) {
50
+            $this->searchParameterName = $this->parameters['searchResultsParameterName'];
51
+        }
52
+    }
53 53
 
54 54
 }
55 55
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/DocumentFolderComponent.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -10,39 +10,39 @@
 block discarded – undo
10 10
 
11 11
 class DocumentFolderComponent extends BaseComponent
12 12
 {
13
-	const PARAMETER_DOCUMENT_FOLDER_PATH = 'documentFolderPath';
14
-	const PARAMETER_DOCUMENT_FOLDER_PARAMETER_NAME = 'documentFolderParameter';
15
-
16
-	protected $documentFolderParameterName = 'folder';
17
-	protected $documentFolderPath;
18
-
19
-	/**
20
-	 * @param Storage $storage
21
-	 *
22
-	 * @return mixed|void
23
-	 * @throws \Exception
24
-	 */
25
-	public function run(Storage $storage)
26
-	{
27
-		parent::run($storage);
28
-
29
-		$this->checkParameters();
30
-
31
-		$this->parameters[$this->documentFolderParameterName] = $this->storage->getDocumentFolderBySlug($this->documentFolderPath);
32
-	}
33
-
34
-
35
-	/**
36
-	 * Checks to see if any parameters were defined in the cms and acts according
37
-	 */
38
-	private function checkParameters()
39
-	{
40
-		if (isset($this->parameters[self::PARAMETER_DOCUMENT_FOLDER_PATH])) {
41
-			$this->documentFolderPath = $this->parameters[self::PARAMETER_DOCUMENT_FOLDER_PATH];
42
-		}
43
-
44
-		if (isset($this->parameters[self::PARAMETER_DOCUMENT_FOLDER_PARAMETER_NAME])) {
45
-			$this->documentFolderParameterName = $this->parameters[self::PARAMETER_DOCUMENT_FOLDER_PARAMETER_NAME];
46
-		}
47
-	}
13
+    const PARAMETER_DOCUMENT_FOLDER_PATH = 'documentFolderPath';
14
+    const PARAMETER_DOCUMENT_FOLDER_PARAMETER_NAME = 'documentFolderParameter';
15
+
16
+    protected $documentFolderParameterName = 'folder';
17
+    protected $documentFolderPath;
18
+
19
+    /**
20
+     * @param Storage $storage
21
+     *
22
+     * @return mixed|void
23
+     * @throws \Exception
24
+     */
25
+    public function run(Storage $storage)
26
+    {
27
+        parent::run($storage);
28
+
29
+        $this->checkParameters();
30
+
31
+        $this->parameters[$this->documentFolderParameterName] = $this->storage->getDocumentFolderBySlug($this->documentFolderPath);
32
+    }
33
+
34
+
35
+    /**
36
+     * Checks to see if any parameters were defined in the cms and acts according
37
+     */
38
+    private function checkParameters()
39
+    {
40
+        if (isset($this->parameters[self::PARAMETER_DOCUMENT_FOLDER_PATH])) {
41
+            $this->documentFolderPath = $this->parameters[self::PARAMETER_DOCUMENT_FOLDER_PATH];
42
+        }
43
+
44
+        if (isset($this->parameters[self::PARAMETER_DOCUMENT_FOLDER_PARAMETER_NAME])) {
45
+            $this->documentFolderParameterName = $this->parameters[self::PARAMETER_DOCUMENT_FOLDER_PARAMETER_NAME];
46
+        }
47
+    }
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.