Passed
Branch develop (5fb105)
by Jens
02:47
created
cloudcontrol/library/cc/errorhandler.php 3 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function shutdownHandler () {
33 33
 	$error = error_get_last(); 
34
-    if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { 
35
-        errorHandler($error['type'],$error['message'],$error['file'],$error['line']);
36
-    }elseif ($error['type'] == 1) {
37
-        dump($error);
38
-    }
34
+	if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { 
35
+		errorHandler($error['type'],$error['message'],$error['file'],$error['line']);
36
+	}elseif ($error['type'] == 1) {
37
+		dump($error);
38
+	}
39 39
 }
40 40
 
41 41
 /**
@@ -49,28 +49,28 @@  discard block
 block discarded – undo
49 49
 	$jsonErrorNr = json_last_error();
50 50
 	$errstr = '';
51 51
 	switch ($jsonErrorNr) {
52
-        case JSON_ERROR_NONE:
53
-            $errstr .= ' - No errors' . PHP_EOL;
54
-        break;
55
-        case JSON_ERROR_DEPTH:
56
-            $errstr .= ' - Maximum stack depth exceeded' . PHP_EOL;
57
-        break;
58
-        case JSON_ERROR_STATE_MISMATCH:
59
-            $errstr .= ' - Underflow or the modes mismatch' . PHP_EOL;
60
-        break;
61
-        case JSON_ERROR_CTRL_CHAR:
62
-            $errstr .= ' - Unexpected control character found' . PHP_EOL;
63
-        break;
64
-        case JSON_ERROR_SYNTAX:
65
-            $errstr .= ' - Syntax error, malformed JSON' . PHP_EOL;
66
-        break;
67
-        case JSON_ERROR_UTF8:
68
-            $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL;
69
-        break;
70
-        default:
71
-            $errstr = ' - Unknown error' . PHP_EOL;
72
-        break;
73
-    }
52
+		case JSON_ERROR_NONE:
53
+			$errstr .= ' - No errors' . PHP_EOL;
54
+		break;
55
+		case JSON_ERROR_DEPTH:
56
+			$errstr .= ' - Maximum stack depth exceeded' . PHP_EOL;
57
+		break;
58
+		case JSON_ERROR_STATE_MISMATCH:
59
+			$errstr .= ' - Underflow or the modes mismatch' . PHP_EOL;
60
+		break;
61
+		case JSON_ERROR_CTRL_CHAR:
62
+			$errstr .= ' - Unexpected control character found' . PHP_EOL;
63
+		break;
64
+		case JSON_ERROR_SYNTAX:
65
+			$errstr .= ' - Syntax error, malformed JSON' . PHP_EOL;
66
+		break;
67
+		case JSON_ERROR_UTF8:
68
+			$errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL;
69
+		break;
70
+		default:
71
+			$errstr = ' - Unknown error' . PHP_EOL;
72
+		break;
73
+	}
74 74
 	errorHandler ($jsonErrorNr, $errstr, $file, $line);
75 75
 }
76 76
 
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function renderError ($message='', $file='', $line='', $code=0, $trace=array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') {
88 88
 	$file_lines = file_exists($file) ? file($file) : array();
89
-    $range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15);
90
-    $lines = array();
89
+	$range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15);
90
+	$lines = array();
91 91
 
92
-    foreach ($range as $line_number) {
93
-        if(isset($file_lines[$line_number-1])) {
94
-            $lines[$line_number] = $file_lines[$line_number-1];
95
-        }
96
-    }
92
+	foreach ($range as $line_number) {
93
+		if(isset($file_lines[$line_number-1])) {
94
+			$lines[$line_number] = $file_lines[$line_number-1];
95
+		}
96
+	}
97 97
 	if (ob_get_contents()) ob_end_clean();
98 98
 	$error = array(
99 99
 		'message' 		=> $message,
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * @param $e
11 11
  */
12
-function exceptionHandler ($e) {
13
-	renderError($e->getMessage(),$e->getFile(),$e->getLine(),$e->getCode(),$e->getTrace());
12
+function exceptionHandler($e) {
13
+	renderError($e->getMessage(), $e->getFile(), $e->getLine(), $e->getCode(), $e->getTrace());
14 14
 }
15 15
 
16 16
 /**
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
  * @param $errfile
22 22
  * @param $errline
23 23
  */
24
-function errorHandler ($errno, $errstr, $errfile, $errline) {
25
-	renderError($errstr,$errfile,$errline,$errno,debug_backtrace());
24
+function errorHandler($errno, $errstr, $errfile, $errline) {
25
+	renderError($errstr, $errfile, $errline, $errno, debug_backtrace());
26 26
 }
27 27
 
28 28
 /**
29 29
  * When an error occurs that kills the process, still try
30 30
  * to show it using a shutdownHandler.
31 31
  */
32
-function shutdownHandler () {
32
+function shutdownHandler() {
33 33
 	$error = error_get_last(); 
34 34
     if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { 
35
-        errorHandler($error['type'],$error['message'],$error['file'],$error['line']);
35
+        errorHandler($error['type'], $error['message'], $error['file'], $error['line']);
36 36
     }elseif ($error['type'] == 1) {
37 37
         dump($error);
38 38
     }
@@ -50,28 +50,28 @@  discard block
 block discarded – undo
50 50
 	$errstr = '';
51 51
 	switch ($jsonErrorNr) {
52 52
         case JSON_ERROR_NONE:
53
-            $errstr .= ' - No errors' . PHP_EOL;
53
+            $errstr .= ' - No errors'.PHP_EOL;
54 54
         break;
55 55
         case JSON_ERROR_DEPTH:
56
-            $errstr .= ' - Maximum stack depth exceeded' . PHP_EOL;
56
+            $errstr .= ' - Maximum stack depth exceeded'.PHP_EOL;
57 57
         break;
58 58
         case JSON_ERROR_STATE_MISMATCH:
59
-            $errstr .= ' - Underflow or the modes mismatch' . PHP_EOL;
59
+            $errstr .= ' - Underflow or the modes mismatch'.PHP_EOL;
60 60
         break;
61 61
         case JSON_ERROR_CTRL_CHAR:
62
-            $errstr .= ' - Unexpected control character found' . PHP_EOL;
62
+            $errstr .= ' - Unexpected control character found'.PHP_EOL;
63 63
         break;
64 64
         case JSON_ERROR_SYNTAX:
65
-            $errstr .= ' - Syntax error, malformed JSON' . PHP_EOL;
65
+            $errstr .= ' - Syntax error, malformed JSON'.PHP_EOL;
66 66
         break;
67 67
         case JSON_ERROR_UTF8:
68
-            $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL;
68
+            $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded'.PHP_EOL;
69 69
         break;
70 70
         default:
71
-            $errstr = ' - Unknown error' . PHP_EOL;
71
+            $errstr = ' - Unknown error'.PHP_EOL;
72 72
         break;
73 73
     }
74
-	errorHandler ($jsonErrorNr, $errstr, $file, $line);
74
+	errorHandler($jsonErrorNr, $errstr, $file, $line);
75 75
 }
76 76
 
77 77
 /**
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
  * @param array  $trace
85 85
  * @param string $httpHeader
86 86
  */
87
-function renderError ($message='', $file='', $line='', $code=0, $trace=array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') {
87
+function renderError($message = '', $file = '', $line = '', $code = 0, $trace = array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') {
88 88
 	$file_lines = file_exists($file) ? file($file) : array();
89 89
     $range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15);
90 90
     $lines = array();
91 91
 
92 92
     foreach ($range as $line_number) {
93
-        if(isset($file_lines[$line_number-1])) {
94
-            $lines[$line_number] = $file_lines[$line_number-1];
93
+        if (isset($file_lines[$line_number - 1])) {
94
+            $lines[$line_number] = $file_lines[$line_number - 1];
95 95
         }
96 96
     }
97 97
 	if (ob_get_contents()) ob_end_clean();
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 		'trace' 		=> $trace,
105 105
 		'httpHeader' 	=> $httpHeader,
106 106
 	);
107
-	if (file_exists(realpath(__DIR__) . '/errorview.php')) {
108
-		include(realpath(__DIR__) . '/errorview.php');
107
+	if (file_exists(realpath(__DIR__).'/errorview.php')) {
108
+		include(realpath(__DIR__).'/errorview.php');
109 109
 	} else {
110 110
 		header('Content-type: application/json');
111 111
 		die(json_encode($error));
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	$error = error_get_last(); 
34 34
     if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { 
35 35
         errorHandler($error['type'],$error['message'],$error['file'],$error['line']);
36
-    }elseif ($error['type'] == 1) {
36
+    } elseif ($error['type'] == 1) {
37 37
         dump($error);
38 38
     }
39 39
 }
@@ -94,7 +94,9 @@  discard block
 block discarded – undo
94 94
             $lines[$line_number] = $file_lines[$line_number-1];
95 95
         }
96 96
     }
97
-	if (ob_get_contents()) ob_end_clean();
97
+	if (ob_get_contents()) {
98
+		ob_end_clean();
99
+	}
98 100
 	$error = array(
99 101
 		'message' 		=> $message,
100 102
 		'file' 			=> $file,
Please login to merge, or discard this patch.
cloudcontrol/library/cc/Request.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@
 block discarded – undo
47 47
 		{
48 48
 			global $rootPath;
49 49
 			
50
-			self::$subfolders = '/' . str_replace('//', '/', str_replace(str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']), "", $rootPath));
50
+			self::$subfolders = '/'.str_replace('//', '/', str_replace(str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']), "", $rootPath));
51 51
 			self::$requestUri = $_SERVER['REQUEST_URI'];
52 52
 			self::$queryString = $_SERVER['QUERY_STRING'];
53
-			self::$relativeUri = str_replace('?' . self::$queryString, '', str_replace(self::$subfolders, '', self::$requestUri));
53
+			self::$relativeUri = str_replace('?'.self::$queryString, '', str_replace(self::$subfolders, '', self::$requestUri));
54 54
 			self::$requestParameters = explode('/', self::$relativeUri);
55 55
 			
56 56
 			self::$get = $_GET;
Please login to merge, or discard this patch.
cloudcontrol/library/images/ImageResizer.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		}
26 26
 
27 27
 		/**
28
-		 * @param $imagePath
28
+		 * @param string $imagePath
29 29
 		 *
30 30
 		 * @return array
31 31
 		 * @throws \Exception
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		}
113 113
 
114 114
 		/**
115
-		 * @param        $imagePath
115
+		 * @param        string $imagePath
116 116
 		 * @param string $modifier
117 117
 		 *
118 118
 		 * @return string
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 				}
48 48
 				return $returnFileNames;
49 49
 			} else {
50
-				throw new \Exception('Image doesnt exist: ' . $imagePath);
50
+				throw new \Exception('Image doesnt exist: '.$imagePath);
51 51
 			}
52 52
 		}
53 53
 
54
-		public function resize($imagePath='', $width='',$height='')
54
+		public function resize($imagePath = '', $width = '', $height = '')
55 55
 		{
56
-			$modifier = '-r' . $width . 'x' . $height;
56
+			$modifier = '-r'.$width.'x'.$height;
57 57
 			$destination = $this->modifyName($imagePath, $modifier);
58 58
 			if (file_exists($imagePath)) {
59 59
 				$image = new Image();
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 				$resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80);
68 68
 				return basename($destination);
69 69
 			} else {
70
-				throw new \Exception('Image doesnt exist: ' . $imagePath);
70
+				throw new \Exception('Image doesnt exist: '.$imagePath);
71 71
 			}
72 72
 		}
73 73
 
74
-		public function smartcrop($imagePath='', $width='',$height='')
74
+		public function smartcrop($imagePath = '', $width = '', $height = '')
75 75
 		{
76
-			$modifier = '-s' . $width . 'x' . $height;
76
+			$modifier = '-s'.$width.'x'.$height;
77 77
 			$destination = $this->modifyName($imagePath, $modifier);
78 78
 			if (file_exists($imagePath)) {
79 79
 				$image = new Image();
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 				$resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80);
88 88
 				return basename($destination);
89 89
 			} else {
90
-				throw new \Exception('Image doesnt exist: ' . $imagePath);
90
+				throw new \Exception('Image doesnt exist: '.$imagePath);
91 91
 			}
92 92
 		}
93 93
 
94
-		public function boxcrop($imagePath='', $width='',$height='')
94
+		public function boxcrop($imagePath = '', $width = '', $height = '')
95 95
 		{
96
-			$modifier = '-b' . $width . 'x' . $height;
96
+			$modifier = '-b'.$width.'x'.$height;
97 97
 			$destination = $this->modifyName($imagePath, $modifier);
98 98
 			if (file_exists($imagePath)) {
99 99
 				$image = new Image();
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 				$resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80);
108 108
 				return basename($destination);
109 109
 			} else {
110
-				throw new \Exception('Image doesnt exist: ' . $imagePath);
110
+				throw new \Exception('Image doesnt exist: '.$imagePath);
111 111
 			}
112 112
 		}
113 113
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		 *
118 118
 		 * @return string
119 119
 		 */
120
-		private function modifyName($imagePath, $modifier='')
120
+		private function modifyName($imagePath, $modifier = '')
121 121
 		{
122 122
 			$filename = basename($imagePath);
123 123
 			$path = dirname($imagePath);
@@ -127,25 +127,25 @@  discard block
 block discarded – undo
127 127
 				array_pop($fileParts);
128 128
 				$fileNameWithoutExtension = implode('-', $fileParts);
129 129
 				$fileNameWithoutExtension = slugify($fileNameWithoutExtension);
130
-				$filename = $fileNameWithoutExtension . $modifier  . '.' . $extension;
130
+				$filename = $fileNameWithoutExtension.$modifier.'.'.$extension;
131 131
 			} else {
132 132
 				$filename = slugify($filename);
133 133
 			}
134 134
 
135
-			if (file_exists($path . '/' . $filename)) {
135
+			if (file_exists($path.'/'.$filename)) {
136 136
 				$fileParts = explode('.', $filename);
137 137
 				if (count($fileParts) > 1) {
138 138
 					$extension = end($fileParts);
139 139
 					array_pop($fileParts);
140 140
 					$fileNameWithoutExtension = implode('-', $fileParts);
141 141
 					$fileNameWithoutExtension .= '-copy';
142
-					$filename = $fileNameWithoutExtension . '.' . $extension;
142
+					$filename = $fileNameWithoutExtension.'.'.$extension;
143 143
 				} else {
144 144
 					$filename .= '-copy';
145 145
 				}
146
-				return $this->modifyName($path . '/' . $filename);
146
+				return $this->modifyName($path.'/'.$filename);
147 147
 			}
148
-			return $path . '/' . $filename;
148
+			return $path.'/'.$filename;
149 149
 		}
150 150
 
151 151
 		private function validateFilename($filename, $path)
Please login to merge, or discard this patch.
cloudcontrol/library/images/methods/Crop.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.