Completed
Push — master ( d6a65e...e090e4 )
by Daniel
02:17
created
code/EnvironmentCheckSuite.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,7 +75,9 @@  discard block
 block discarded – undo
75 75
 
76 76
 			// Existing named checks can be disabled by setting their 'state' to 'disabled'.
77 77
 			// This is handy for disabling checks mandated by modules.
78
-			if (!empty($check['state']) && $check['state']==='disabled') continue;
78
+			if (!empty($check['state']) && $check['state']==='disabled') {
79
+				continue;
80
+			}
79 81
 			
80 82
 			// Add the check to this suite.
81 83
 			$this->push($check['definition'], $check['title']);
@@ -158,7 +160,9 @@  discard block
 block discarded – undo
158 160
 	 * @return EnvironmentCheckSuite
159 161
 	 */
160 162
 	static function inst($name) {
161
-		if(!isset(self::$instances[$name])) self::$instances[$name] = new EnvironmentCheckSuite($name);
163
+		if(!isset(self::$instances[$name])) {
164
+			self::$instances[$name] = new EnvironmentCheckSuite($name);
165
+		}
162 166
 		return self::$instances[$name];
163 167
 	}
164 168
 
@@ -170,8 +174,12 @@  discard block
 block discarded – undo
170 174
 	 * @param string|array
171 175
 	 */
172 176
 	static function register($names, $check, $title = null) {
173
-		if(!is_array($names)) $names = array($names);
174
-		foreach($names as $name) self::inst($name)->push($check, $title);
177
+		if(!is_array($names)) {
178
+			$names = array($names);
179
+		}
180
+		foreach($names as $name) {
181
+			self::inst($name)->push($check, $title);
182
+		}
175 183
 	}
176 184
 
177 185
 	/**
Please login to merge, or discard this patch.
code/EnvironmentChecker.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -104,7 +104,9 @@  discard block
 block discarded – undo
104 104
 				throw $e;
105 105
 			}
106 106
 		} else {
107
-			if(!$this->canAccess(null, $permission)) return $this->httpError(403);
107
+			if(!$this->canAccess(null, $permission)) {
108
+				return $this->httpError(403);
109
+			}
108 110
 		}
109 111
 	}
110 112
 
@@ -141,8 +143,11 @@  discard block
 block discarded – undo
141 143
 		$canExtended = null;
142 144
 		$results = $this->extend('canAccess', $member);
143 145
 		if($results && is_array($results)) {
144
-			if(!min($results)) return false;
145
-			else return true;
146
+			if(!min($results)) {
147
+				return false;
148
+			} else {
149
+				return true;
150
+			}
146 151
 		}
147 152
 
148 153
 		return false;
Please login to merge, or discard this patch.
code/checks/ExternalURLCheck.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@  discard block
 block discarded – undo
24 24
 	 * @param int $timeout
25 25
 	 */
26 26
 	function __construct($urls, $timeout = 15) {
27
-		if($urls) $this->urls = explode(' ', $urls);
27
+		if($urls) {
28
+			$this->urls = explode(' ', $urls);
29
+		}
28 30
 		$this->timeout = $timeout;
29 31
 	}
30 32
 
@@ -44,7 +46,9 @@  discard block
 block discarded – undo
44 46
 		}	
45 47
 		// Parallel execution for faster performance
46 48
 		$mh = curl_multi_init();
47
-		foreach($chs as $ch) curl_multi_add_handle($mh,$ch);
49
+		foreach($chs as $ch) {
50
+			curl_multi_add_handle($mh,$ch);
51
+		}
48 52
 		
49 53
 		$active = null;
50 54
 		// Execute the handles
@@ -84,7 +88,9 @@  discard block
 block discarded – undo
84 88
 		}
85 89
 
86 90
 		// Close the handles
87
-		foreach($chs as $ch) curl_multi_remove_handle($mh, $ch);
91
+		foreach($chs as $ch) {
92
+			curl_multi_remove_handle($mh, $ch);
93
+		}
88 94
 		curl_multi_close($mh);
89 95
 		
90 96
 		if($hasError) {
Please login to merge, or discard this patch.
code/checks/FileAccessibilityAndValidationCheck.php 1 patch
Braces   +9 added lines, -8 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 				foreach($files as $file){
82 82
 					if($this->$fileTypeValidateFunc($file)){
83 83
 						$validFiles[] = $file;
84
-					}else{
84
+					} else{
85 85
 						$invalidFiles[] = $file;
86 86
 					}
87 87
 				}
@@ -97,15 +97,16 @@  discard block
 block discarded – undo
97 97
 							EnvironmentCheck::OK,
98 98
 							sprintf('At least these file(s) accessible: %s', $validFileList)
99 99
 						);
100
-					}else{
100
+					} else{
101 101
 						$checkReturn = array(
102 102
 							EnvironmentCheck::OK,
103 103
 							sprintf('At least these file(s) passed file type validate function "%s": %s', $fileTypeValidateFunc, $validFileList)
104 104
 						);
105 105
 					}
106 106
 				} else {
107
-					if (count($invalidFiles) == 0) $checkReturn = array(EnvironmentCheck::OK, 'All files valideted');
108
-					else {
107
+					if (count($invalidFiles) == 0) {
108
+						$checkReturn = array(EnvironmentCheck::OK, 'All files valideted');
109
+					} else {
109 110
 						$invalidFileList = "\n";
110 111
 						foreach($invalidFiles as $vf){
111 112
 							$invalidFileList .= $vf."\n";
@@ -116,7 +117,7 @@  discard block
 block discarded – undo
116 117
 								EnvironmentCheck::ERROR,
117 118
 								sprintf('File(s) not accessible: %s', $invalidFileList)
118 119
 							);
119
-						}else{
120
+						} else{
120 121
 							$checkReturn = array(
121 122
 								EnvironmentCheck::ERROR,
122 123
 								sprintf('File(s) not passing the file type validate function "%s": %s', $fileTypeValidateFunc, $invalidFileList)
@@ -125,14 +126,14 @@  discard block
 block discarded – undo
125 126
 	
126 127
 					}
127 128
 				}
128
-			}else{
129
+			} else{
129 130
 				$checkReturn =  array(
130 131
 					EnvironmentCheck::ERROR,
131 132
 					sprintf("Invalid file type validation method name passed: %s ", $fileTypeValidateFunc)
132 133
 				);
133 134
 			}
134 135
 
135
-		}else{
136
+		} else{
136 137
 			$checkReturn = array(
137 138
 				EnvironmentCheck::ERROR,
138 139
 				sprintf("No files accessible at path %s", $this->path)
@@ -153,7 +154,7 @@  discard block
 block discarded – undo
153 154
 		$json = json_decode(file_get_contents($file));
154 155
 		if(!$json) {
155 156
 			return false;
156
-		}else{
157
+		} else{
157 158
 			return true;
158 159
 		}
159 160
 	}
Please login to merge, or discard this patch.
code/checks/FileAgeCheck.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,8 +92,10 @@  discard block
 block discarded – undo
92 92
 		$validFiles = array();
93 93
 		$checkFn = $this->checkFn;
94 94
 		$allValid = true;
95
-		if($files) foreach($files as $file) {
95
+		if($files) {
96
+			foreach($files as $file) {
96 97
 			$fileTime = $checkFn($file);
98
+		}
97 99
 			$valid = ($this->compareOperand == '>') ? ($fileTime >= $cutoffTime) : ($fileTime <= $cutoffTime);
98 100
 			if($valid) {
99 101
 				$validFiles[] = $file;
@@ -115,11 +117,14 @@  discard block
 block discarded – undo
115 117
 		if($this->checkType == self::CHECK_SINGLE && count($invalidFiles) < count($files)) {
116 118
 			return array(EnvironmentCheck::OK, '');
117 119
 		} else {
118
-	       if (count($invalidFiles) == 0) return array(EnvironmentCheck::OK, '');
119
-	       else return array(
120
+	       if (count($invalidFiles) == 0) {
121
+	       	return array(EnvironmentCheck::OK, '');
122
+	       } else {
123
+	       	return array(
120 124
 				EnvironmentCheck::ERROR,
121 125
 				sprintf('No files matched criteria (%s %s)', $this->compareOperand, date('c', $cutoffTime))
122 126
 			);
127
+	       }
123 128
 		}
124 129
 			
125 130
 	}
Please login to merge, or discard this patch.
code/checks/FileWriteableCheck.php 1 patch
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,11 +22,17 @@  discard block
 block discarded – undo
22 22
 	 * @return array
23 23
 	 */
24 24
 	function check() {
25
-		if($this->path[0] == '/') $filename = $this->path;
26
-		else $filename = BASE_PATH . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $this->path);
25
+		if($this->path[0] == '/') {
26
+			$filename = $this->path;
27
+		} else {
28
+			$filename = BASE_PATH . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $this->path);
29
+		}
27 30
 		
28
-		if(file_exists($filename)) $isWriteable = is_writeable($filename);
29
-		else $isWriteable = is_writeable(dirname($filename));
31
+		if(file_exists($filename)) {
32
+			$isWriteable = is_writeable($filename);
33
+		} else {
34
+			$isWriteable = is_writeable(dirname($filename));
35
+		}
30 36
 		
31 37
 		if(!$isWriteable) {
32 38
 			if(function_exists('posix_getgroups')) {
@@ -46,7 +52,9 @@  discard block
 block discarded – undo
46 52
 					$groupList = array();
47 53
 					foreach($groups as $group) {
48 54
 						$groupInfo = posix_getgrgid($group);
49
-						if(in_array($currentOwner['name'], $groupInfo['members'])) $groupList[] = $groupInfo['name'];
55
+						if(in_array($currentOwner['name'], $groupInfo['members'])) {
56
+							$groupList[] = $groupInfo['name'];
57
+						}
50 58
 					}
51 59
 					if($groupList) {
52 60
 						$message .= "	We recommend that you make the file group-writeable and change the group to one of these groups:\n - ". implode("\n - ", $groupList)
Please login to merge, or discard this patch.
code/checks/HasClassCheck.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,10 @@
 block discarded – undo
22 22
 	 * @return array
23 23
 	 */
24 24
 	function check() {
25
-		if(class_exists($this->className)) return array(EnvironmentCheck::OK, 'Class ' . $this->className.' exists');
26
-		else return array(EnvironmentCheck::ERROR, 'Class ' . $this->className.' doesn\'t exist');
25
+		if(class_exists($this->className)) {
26
+			return array(EnvironmentCheck::OK, 'Class ' . $this->className.' exists');
27
+		} else {
28
+			return array(EnvironmentCheck::ERROR, 'Class ' . $this->className.' doesn\'t exist');
29
+		}
27 30
 	}
28 31
 }
Please login to merge, or discard this patch.
code/checks/HasFunctionCheck.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,10 @@
 block discarded – undo
22 22
 	 * @return array
23 23
 	 */
24 24
 	function check() {
25
-		if(function_exists($this->functionName)) return array(EnvironmentCheck::OK, $this->functionName.'() exists');
26
-		else return array(EnvironmentCheck::ERROR, $this->functionName.'() doesn\'t exist');
25
+		if(function_exists($this->functionName)) {
26
+			return array(EnvironmentCheck::OK, $this->functionName.'() exists');
27
+		} else {
28
+			return array(EnvironmentCheck::ERROR, $this->functionName.'() doesn\'t exist');
29
+		}
27 30
 	}
28 31
 }
Please login to merge, or discard this patch.
code/checks/SMTPConnectCheck.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,10 +30,14 @@
 block discarded – undo
30 30
 	 */
31 31
 	function __construct($host = null, $port = null, $timeout = 15) {
32 32
 		$this->host = ($host) ? $host : ini_get('SMTP');
33
-		if(!$this->host) $this->host = 'localhost';
33
+		if(!$this->host) {
34
+			$this->host = 'localhost';
35
+		}
34 36
 		
35 37
 		$this->port = ($port) ? $port : ini_get('smtp_port');
36
-		if(!$this->port) $this->port = 25;
38
+		if(!$this->port) {
39
+			$this->port = 25;
40
+		}
37 41
 
38 42
 		$this->timeout = $timeout;
39 43
 	}
Please login to merge, or discard this patch.