Completed
Branch master (188864)
by Joe
04:05
created
src/Cloudlinux.php 1 patch
Braces   +33 added lines, -26 removed lines patch added patch discarded remove patch
@@ -57,8 +57,9 @@  discard block
 block discarded – undo
57 57
 	public function __construct($login, $key, $type = 'rest') {
58 58
 		$this->login = $login;
59 59
 		$this->key = $key;
60
-		if (!isset($GLOBALS['HTTP_RAW_POST_DATA']))
61
-			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input');
60
+		if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
61
+					$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input');
62
+		}
62 63
 		//if ($api_type == 'xml') {
63 64
 			include_once('XML/RPC2/Client.php');
64 65
 			$this->xml_options['prefix'] = $this->prefix;
@@ -108,10 +109,11 @@  discard block
 block discarded – undo
108 109
 	}
109 110
 
110 111
 	public function log($level, $text, $line = '', $file = '') {
111
-		if (function_exists('myadmin_log'))
112
-			myadmin_log('cloudlinux', $level, $text, $line, $file);
113
-		else
114
-			error_log($text);
112
+		if (function_exists('myadmin_log')) {
113
+					myadmin_log('cloudlinux', $level, $text, $line, $file);
114
+		} else {
115
+					error_log($text);
116
+		}
115 117
 	}
116 118
 
117 119
 	/**
@@ -143,10 +145,11 @@  discard block
 block discarded – undo
143 145
 	public function check($ip) {
144 146
 		$this->response = $this->getcurlpage($this->rest_url.'ipl/check.json?ip='.$ip.'&token='.$this->authToken(), '', $this->rest_options);
145 147
 		$response = json_decode($this->response, true);
146
-		if ($response['success'] == 1)
147
-			return $response['data'];
148
-		else
149
-			return false;
148
+		if ($response['success'] == 1) {
149
+					return $response['data'];
150
+		} else {
151
+					return false;
152
+		}
150 153
 	}
151 154
 
152 155
 	/**
@@ -169,10 +172,11 @@  discard block
 block discarded – undo
169 172
 	 * @return bool
170 173
 	 */
171 174
 	public function rest_remove($ip, $type = 0) {
172
-		if ($type != 0)
173
-			$this->response = $this->getcurlpage($this->rest_url.'ipl/remove.json?ip='.$ip.'&type='.$type.'&token='.$this->authToken(), '', $this->rest_options);
174
-		else
175
-			$this->response = $this->getcurlpage($this->rest_url.'ipl/remove.json?ip='.$ip.'&token='.$this->authToken(), '', $this->rest_options);
175
+		if ($type != 0) {
176
+					$this->response = $this->getcurlpage($this->rest_url.'ipl/remove.json?ip='.$ip.'&type='.$type.'&token='.$this->authToken(), '', $this->rest_options);
177
+		} else {
178
+					$this->response = $this->getcurlpage($this->rest_url.'ipl/remove.json?ip='.$ip.'&token='.$this->authToken(), '', $this->rest_options);
179
+		}
176 180
 		return json_decode($this->response, true);
177 181
 	}
178 182
 
@@ -184,10 +188,11 @@  discard block
 block discarded – undo
184 188
 	 * @return bool
185 189
 	 */
186 190
 	public function remove($ip, $type = 0) {
187
-		if ($this->api_type == 'xml')
188
-			return $this->remove_license($ip, $type);
189
-		else
190
-			return $this->rest_remove($ip, $type);
191
+		if ($this->api_type == 'xml') {
192
+					return $this->remove_license($ip, $type);
193
+		} else {
194
+					return $this->rest_remove($ip, $type);
195
+		}
191 196
 	}
192 197
 
193 198
 	/**
@@ -249,10 +254,11 @@  discard block
 block discarded – undo
249 254
 	public function remove_license($ip, $type = false) {
250 255
 		$this->log('info', "Calling CLoudLinux->xml_client->remove_license({$this->authToken()}, {$ip}, {$type})", __LINE__, __FILE__);
251 256
 		try {
252
-			if ($type === false)
253
-				return $this->response = $this->xml_client->remove_license($this->authToken(), $ip);
254
-			else
255
-				return $this->response = $this->xml_client->remove_license($this->authToken(), $ip, $type);
257
+			if ($type === false) {
258
+							return $this->response = $this->xml_client->remove_license($this->authToken(), $ip);
259
+			} else {
260
+							return $this->response = $this->xml_client->remove_license($this->authToken(), $ip, $type);
261
+			}
256 262
 		} catch (Exception $e) {
257 263
 			$this->log('error', 'Caught exception code: ' . $e->getCode());
258 264
 			$this->log('error', 'Caught exception message: ' . $e->getMessage());
@@ -269,10 +275,11 @@  discard block
 block discarded – undo
269 275
 	 * @return array (list<int>): List of registered license types or empty list if no license found
270 276
 	 */
271 277
 	public function is_licensed($ip, $checkAll = true) {
272
-		if ($this->api_type == 'xml')
273
-			return $this->xml_is_licensed($ip, $checkAll);
274
-		else
275
-			return $this->check($ip, $checkAll);
278
+		if ($this->api_type == 'xml') {
279
+					return $this->xml_is_licensed($ip, $checkAll);
280
+		} else {
281
+					return $this->check($ip, $checkAll);
282
+		}
276 283
 	}
277 284
 	/**
278 285
 	 * Check if IP license was registered by any customer. Arguments:
Please login to merge, or discard this patch.