Test Failed
Pull Request — master (#1)
by
unknown
08:08 queued 05:23
created
src/Cpanel.php 2 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 	public $opts;
17 17
 
18 18
 	/**
19
-	* Cpanel constructor.
20
-	*
21
-	* @param $user
22
-	* @param $pass
23
-	*/
19
+	 * Cpanel constructor.
20
+	 *
21
+	 * @param $user
22
+	 * @param $pass
23
+	 */
24 24
 	public function __construct($user, $pass)
25 25
 	{
26 26
 		$this->opts = [];
@@ -31,29 +31,29 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 
33 33
 	/**
34
-	* @param $option
35
-	* @param $value
36
-	*/
34
+	 * @param $option
35
+	 * @param $value
36
+	 */
37 37
 	public function setopt($option, $value)
38 38
 	{
39 39
 		$this->opts[$option] = $value;
40 40
 	}
41 41
 
42 42
 	/**
43
-	* sets the login credentials
44
-	* @param string $user the username
45
-	* @param string $pass the password
46
-	*/
43
+	 * sets the login credentials
44
+	 * @param string $user the username
45
+	 * @param string $pass the password
46
+	 */
47 47
 	public function setCredentials($user, $pass)
48 48
 	{
49 49
 		$this->setopt(CURLOPT_USERPWD, $user.':'.$pass);
50 50
 	}
51 51
 
52 52
 	/**
53
-	* sets the output format
54
-	*
55
-	* @param string $format can be any of xml,json,yaml,simplexml
56
-	*/
53
+	 * sets the output format
54
+	 *
55
+	 * @param string $format can be any of xml,json,yaml,simplexml
56
+	 */
57 57
 	public function setFormat($format)
58 58
 	{
59 59
 		if ($format != 'xml' && $format != 'json' && $format != 'yaml' && $format != 'simplexml') {
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	}
66 66
 
67 67
 	/**
68
-	* @param string $function
69
-	* @param array $args
70
-	* @return array|mixed|void
71
-	*/
68
+	 * @param string $function
69
+	 * @param array $args
70
+	 * @return array|mixed|void
71
+	 */
72 72
 	private function get($function, $args = [])
73 73
 	{
74 74
 		if (!$function) {
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	/**
113
-	* formats the response
114
-	* @param array $result the result array to format
115
-	* @return array the rormatted arrray
116
-	*/
113
+	 * formats the response
114
+	 * @param array $result the result array to format
115
+	 * @return array the rormatted arrray
116
+	 */
117 117
 	private function formatResult($result)
118 118
 	{
119 119
 		if (is_array($result)) {
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 	}
132 132
 
133 133
 	/**
134
-	* @param $id
135
-	* @return int
136
-	*/
134
+	 * @param $id
135
+	 * @return int
136
+	 */
137 137
 	private function validateID($id)
138 138
 	{
139 139
 		if (preg_match("/^(L|P|G)?\d*$/", $id)) {
@@ -144,18 +144,18 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 
146 146
 	/**
147
-	* @param $ipAddress
148
-	* @return int
149
-	*/
147
+	 * @param $ipAddress
148
+	 * @return int
149
+	 */
150 150
 	private function validateIP($ipAddress)
151 151
 	{
152 152
 		return preg_match("/^\d*\.\d*\.\d*\.\d*$/", $ipAddress);
153 153
 	}
154 154
 
155 155
 	/**
156
-	* @param $args
157
-	* @return array|mixed|void
158
-	*/
156
+	 * @param $args
157
+	 * @return array|mixed|void
158
+	 */
159 159
 	public function reactivateLicense($args)
160 160
 	{
161 161
 		if (!array_key_exists('liscid', $args)) {
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	/**
173
-	* @param $args
174
-	* @return array|mixed|void
175
-	*/
173
+	 * @param $args
174
+	 * @return array|mixed|void
175
+	 */
176 176
 	public function expireLicense($args)
177 177
 	{
178 178
 		if (!array_key_exists('liscid', $args)) {
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
 	}
188 188
 
189 189
 	/**
190
-	* @param $args
191
-	* @return array|mixed|void
192
-	*/
190
+	 * @param $args
191
+	 * @return array|mixed|void
192
+	 */
193 193
 	public function extendOnetimeUpdates($args)
194 194
 	{
195 195
 		if (!array_key_exists('ip', $args)) {
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 	}
205 205
 
206 206
 	/**
207
-	* @param $args
208
-	* @return array|mixed|void
209
-	*/
207
+	 * @param $args
208
+	 * @return array|mixed|void
209
+	 */
210 210
 	public function changeip($args)
211 211
 	{
212 212
 		if (!array_key_exists('oldip', $args) || !array_key_exists('newip', $args)) {
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 	}
222 222
 
223 223
 	/**
224
-	* @param $args
225
-	* @return array|mixed|void
226
-	*/
224
+	 * @param $args
225
+	 * @return array|mixed|void
226
+	 */
227 227
 	public function requestTransfer($args)
228 228
 	{
229 229
 		if (!array_key_exists('ip', $args) || !array_key_exists('groupid', $args) || !array_key_exists('packagegroup', $args)) {
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 	}
247 247
 
248 248
 	/**
249
-	* @param $args
250
-	* @return array|mixed|void
251
-	*/
249
+	 * @param $args
250
+	 * @return array|mixed|void
251
+	 */
252 252
 	public function activateLicense($args)
253 253
 	{
254 254
 		if (!array_key_exists('ip', $args) || !array_key_exists('groupid', $args) || !array_key_exists('packageid', $args)) {
@@ -272,9 +272,9 @@  discard block
 block discarded – undo
272 272
 	}
273 273
 
274 274
 	/**
275
-	* @param $args
276
-	* @return array|mixed|void
277
-	*/
275
+	 * @param $args
276
+	 * @return array|mixed|void
277
+	 */
278 278
 	public function addPickupPass($args)
279 279
 	{
280 280
 		if (!array_key_exists('pickup', $args)) {
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 	}
286 286
 
287 287
 	/**
288
-	* @param $args
289
-	* @return array|mixed|void
290
-	*/
288
+	 * @param $args
289
+	 * @return array|mixed|void
290
+	 */
291 291
 	public function registerAuth($args)
292 292
 	{
293 293
 		if (!array_key_exists('user', $args)) {
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
 	}
311 311
 
312 312
 	/**
313
-	* return s a list of groups
314
-	*
315
-	* @return array|mixed|void
316
-	*/
313
+	 * return s a list of groups
314
+	 *
315
+	 * @return array|mixed|void
316
+	 */
317 317
 	public function fetchGroups()
318 318
 	{
319 319
 		return $this->get('XMLgroupInfo.cgi');
320 320
 	}
321 321
 
322 322
 	/**
323
-	* fetches license risk data
324
-	*
325
-	* @param array $args
326
-	* @return array|mixed|void
327
-	*/
323
+	 * fetches license risk data
324
+	 *
325
+	 * @param array $args
326
+	 * @return array|mixed|void
327
+	 */
328 328
 	public function fetchLicenseRiskData($args = [])
329 329
 	{
330 330
 		if (!array_key_exists('ip', $args)) {
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 	}
340 340
 
341 341
 	/**
342
-	* gets raw license information
343
-	*
344
-	* @param array $args optional array of arguments
345
-	* @return array|mixed|void
346
-	*/
342
+	 * gets raw license information
343
+	 *
344
+	 * @param array $args optional array of arguments
345
+	 * @return array|mixed|void
346
+	 */
347 347
 	public function fetchLicenseRaw($args = [])
348 348
 	{
349 349
 		$args = array_merge(['all' => 1], $args);
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
 	}
360 360
 
361 361
 	/**
362
-	* gets license information
363
-	*
364
-	* @param array $args optional array of arguments
365
-	* @return array|mixed|void
366
-	*/
362
+	 * gets license information
363
+	 *
364
+	 * @param array $args optional array of arguments
365
+	 * @return array|mixed|void
366
+	 */
367 367
 	public function fetchLicenseId($args = [])
368 368
 	{
369 369
 		$args = array_merge(['all' => 1], $args);
@@ -379,38 +379,38 @@  discard block
 block discarded – undo
379 379
 	}
380 380
 
381 381
 	/**
382
-	* @return array|mixed|void
383
-	*/
382
+	 * @return array|mixed|void
383
+	 */
384 384
 	public function fetchPackages($expand = false)
385 385
 	{
386 386
 		return $this->get('XMLpackageInfo.cgi', ($expand === true ? ['expand' => 1] : []));
387 387
 	}
388 388
 
389 389
 	/**
390
-	* gets a list of licenses
391
-	*
392
-	* @param array $args optional arguments
393
-	* @return array|mixed|void
394
-	*/
390
+	 * gets a list of licenses
391
+	 *
392
+	 * @param array $args optional arguments
393
+	 * @return array|mixed|void
394
+	 */
395 395
 	public function fetchLicenses($args = [])
396 396
 	{
397 397
 		return $this->get('XMLlicenseInfo.cgi');
398 398
 	}
399 399
 
400 400
 	/**
401
-	* return sa list of expired licenses
402
-	* @return array|mixed|void
403
-	*/
401
+	 * return sa list of expired licenses
402
+	 * @return array|mixed|void
403
+	 */
404 404
 	public function fetchExpiredLicenses()
405 405
 	{
406 406
 		return $this->fetchLicenses(['expired' => '1']);
407 407
 	}
408 408
 
409 409
 	/**
410
-	* @param $search
411
-	* @param $xmlObj
412
-	* @return string|void
413
-	*/
410
+	 * @param $search
411
+	 * @param $xmlObj
412
+	 * @return string|void
413
+	 */
414 414
 	public function findKey($search, $xmlObj)
415 415
 	{
416 416
 		$xmlObj = (array) $xmlObj;
Please login to merge, or discard this patch.
Braces   +25 added lines, -50 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * @package Detain\Cpanel
11 11
  */
12
-class Cpanel
13
-{
12
+class Cpanel {
14 13
 	public $format;
15 14
 	public $curl;
16 15
 	public $opts;
@@ -21,8 +20,7 @@  discard block
 block discarded – undo
21 20
 	* @param $user
22 21
 	* @param $pass
23 22
 	*/
24
-	public function __construct($user, $pass)
25
-	{
23
+	public function __construct($user, $pass) {
26 24
 		$this->opts = [];
27 25
 		$this->format = 'simplexml';
28 26
 		$this->setCredentials($user, $pass);
@@ -34,8 +32,7 @@  discard block
 block discarded – undo
34 32
 	* @param $option
35 33
 	* @param $value
36 34
 	*/
37
-	public function setopt($option, $value)
38
-	{
35
+	public function setopt($option, $value) {
39 36
 		$this->opts[$option] = $value;
40 37
 	}
41 38
 
@@ -44,8 +41,7 @@  discard block
 block discarded – undo
44 41
 	* @param string $user the username
45 42
 	* @param string $pass the password
46 43
 	*/
47
-	public function setCredentials($user, $pass)
48
-	{
44
+	public function setCredentials($user, $pass) {
49 45
 		$this->setopt(CURLOPT_USERPWD, $user.':'.$pass);
50 46
 	}
51 47
 
@@ -54,8 +50,7 @@  discard block
 block discarded – undo
54 50
 	*
55 51
 	* @param string $format can be any of xml,json,yaml,simplexml
56 52
 	*/
57
-	public function setFormat($format)
58
-	{
53
+	public function setFormat($format) {
59 54
 		if ($format != 'xml' && $format != 'json' && $format != 'yaml' && $format != 'simplexml') {
60 55
 			error_log('setFormat requires that the format is xml, json, yaml or simplexml');
61 56
 			return;
@@ -69,8 +64,7 @@  discard block
 block discarded – undo
69 64
 	* @param array $args
70 65
 	* @return array|mixed|void
71 66
 	*/
72
-	private function get($function, $args = [])
73
-	{
67
+	private function get($function, $args = []) {
74 68
 		if (!$function) {
75 69
 			error_log('cPanelLicensing::get requires that a function is defined');
76 70
 			return;
@@ -114,8 +108,7 @@  discard block
 block discarded – undo
114 108
 	* @param array $result the result array to format
115 109
 	* @return array the rormatted arrray
116 110
 	*/
117
-	private function formatResult($result)
118
-	{
111
+	private function formatResult($result) {
119 112
 		if (is_array($result)) {
120 113
 			foreach ($result as $key => $value) {
121 114
 				if (is_array($value)) {
@@ -134,8 +127,7 @@  discard block
 block discarded – undo
134 127
 	* @param $id
135 128
 	* @return int
136 129
 	*/
137
-	private function validateID($id)
138
-	{
130
+	private function validateID($id) {
139 131
 		if (preg_match("/^(L|P|G)?\d*$/", $id)) {
140 132
 			return 1;
141 133
 		} else {
@@ -147,8 +139,7 @@  discard block
 block discarded – undo
147 139
 	* @param $ipAddress
148 140
 	* @return int
149 141
 	*/
150
-	private function validateIP($ipAddress)
151
-	{
142
+	private function validateIP($ipAddress) {
152 143
 		return preg_match("/^\d*\.\d*\.\d*\.\d*$/", $ipAddress);
153 144
 	}
154 145
 
@@ -156,8 +147,7 @@  discard block
 block discarded – undo
156 147
 	* @param $args
157 148
 	* @return array|mixed|void
158 149
 	*/
159
-	public function reactivateLicense($args)
160
-	{
150
+	public function reactivateLicense($args) {
161 151
 		if (!array_key_exists('liscid', $args)) {
162 152
 			error_log('cpanelLicensing::reactivateLicense requires that the argument array contains element liscid');
163 153
 			return;
@@ -173,8 +163,7 @@  discard block
 block discarded – undo
173 163
 	* @param $args
174 164
 	* @return array|mixed|void
175 165
 	*/
176
-	public function expireLicense($args)
177
-	{
166
+	public function expireLicense($args) {
178 167
 		if (!array_key_exists('liscid', $args)) {
179 168
 			error_log('cPanelLicensing::expireLicense requires that liscid elements exists in the array passed to it');
180 169
 			return;
@@ -190,8 +179,7 @@  discard block
 block discarded – undo
190 179
 	* @param $args
191 180
 	* @return array|mixed|void
192 181
 	*/
193
-	public function extendOnetimeUpdates($args)
194
-	{
182
+	public function extendOnetimeUpdates($args) {
195 183
 		if (!array_key_exists('ip', $args)) {
196 184
 			error_log('cpanelLicensing::extendOnetimeUpdates requires that the element ip exists in the array is passed to it');
197 185
 			return;
@@ -207,8 +195,7 @@  discard block
 block discarded – undo
207 195
 	* @param $args
208 196
 	* @return array|mixed|void
209 197
 	*/
210
-	public function changeip($args)
211
-	{
198
+	public function changeip($args) {
212 199
 		if (!array_key_exists('oldip', $args) || !array_key_exists('newip', $args)) {
213 200
 			error_log('cpanelLicensing::changeip requires that oldip and newip elements exist in the array passed to it');
214 201
 			return;
@@ -224,8 +211,7 @@  discard block
 block discarded – undo
224 211
 	* @param $args
225 212
 	* @return array|mixed|void
226 213
 	*/
227
-	public function requestTransfer($args)
228
-	{
214
+	public function requestTransfer($args) {
229 215
 		if (!array_key_exists('ip', $args) || !array_key_exists('groupid', $args) || !array_key_exists('packagegroup', $args)) {
230 216
 			error_log('cpanelLicensing::requestTransfer requires that ip, groupid and packageid elements exist in the array passed to it');
231 217
 			return;
@@ -249,8 +235,7 @@  discard block
 block discarded – undo
249 235
 	* @param $args
250 236
 	* @return array|mixed|void
251 237
 	*/
252
-	public function activateLicense($args)
253
-	{
238
+	public function activateLicense($args) {
254 239
 		if (!array_key_exists('ip', $args) || !array_key_exists('groupid', $args) || !array_key_exists('packageid', $args)) {
255 240
 			error_log('cpanelLicensing::activateLicense requires that ip, groupid and packageid elements exist in the array passed to it');
256 241
 			return;
@@ -275,8 +260,7 @@  discard block
 block discarded – undo
275 260
 	* @param $args
276 261
 	* @return array|mixed|void
277 262
 	*/
278
-	public function addPickupPass($args)
279
-	{
263
+	public function addPickupPass($args) {
280 264
 		if (!array_key_exists('pickup', $args)) {
281 265
 			error_log('cPanelLicensing::addPickupPass requires a pickup param');
282 266
 			return;
@@ -288,8 +272,7 @@  discard block
 block discarded – undo
288 272
 	* @param $args
289 273
 	* @return array|mixed|void
290 274
 	*/
291
-	public function registerAuth($args)
292
-	{
275
+	public function registerAuth($args) {
293 276
 		if (!array_key_exists('user', $args)) {
294 277
 			error_log('cPanelLicensing::registerAuth requires a user param');
295 278
 			return;
@@ -314,8 +297,7 @@  discard block
 block discarded – undo
314 297
 	*
315 298
 	* @return array|mixed|void
316 299
 	*/
317
-	public function fetchGroups()
318
-	{
300
+	public function fetchGroups() {
319 301
 		return $this->get('XMLgroupInfo.cgi');
320 302
 	}
321 303
 
@@ -325,8 +307,7 @@  discard block
 block discarded – undo
325 307
 	* @param array $args
326 308
 	* @return array|mixed|void
327 309
 	*/
328
-	public function fetchLicenseRiskData($args = [])
329
-	{
310
+	public function fetchLicenseRiskData($args = []) {
330 311
 		if (!array_key_exists('ip', $args)) {
331 312
 			error_log('cpanelLicensing::fetchLicenseRiskData requires that ip exists as an element in the array is passed to it');
332 313
 			return;
@@ -344,8 +325,7 @@  discard block
 block discarded – undo
344 325
 	* @param array $args optional array of arguments
345 326
 	* @return array|mixed|void
346 327
 	*/
347
-	public function fetchLicenseRaw($args = [])
348
-	{
328
+	public function fetchLicenseRaw($args = []) {
349 329
 		$args = array_merge(['all' => 1], $args);
350 330
 		if (!array_key_exists('ip', $args)) {
351 331
 			error_log('cpanelLicesning::fetchLicenseRaw requires that ip exists as an element in the array is passed to it');
@@ -364,8 +344,7 @@  discard block
 block discarded – undo
364 344
 	* @param array $args optional array of arguments
365 345
 	* @return array|mixed|void
366 346
 	*/
367
-	public function fetchLicenseId($args = [])
368
-	{
347
+	public function fetchLicenseId($args = []) {
369 348
 		$args = array_merge(['all' => 1], $args);
370 349
 		if (!array_key_exists('ip', $args)) {
371 350
 			error_log('cpanelLicensing::getLicenseId requires that an IP is passed to it');
@@ -381,8 +360,7 @@  discard block
 block discarded – undo
381 360
 	/**
382 361
 	* @return array|mixed|void
383 362
 	*/
384
-	public function fetchPackages($expand = false)
385
-	{
363
+	public function fetchPackages($expand = false) {
386 364
 		return $this->get('XMLpackageInfo.cgi', ($expand === true ? ['expand' => 1] : []));
387 365
 	}
388 366
 
@@ -392,8 +370,7 @@  discard block
 block discarded – undo
392 370
 	* @param array $args optional arguments
393 371
 	* @return array|mixed|void
394 372
 	*/
395
-	public function fetchLicenses($args = [])
396
-	{
373
+	public function fetchLicenses($args = []) {
397 374
 		return $this->get('XMLlicenseInfo.cgi');
398 375
 	}
399 376
 
@@ -401,8 +378,7 @@  discard block
 block discarded – undo
401 378
 	* return sa list of expired licenses
402 379
 	* @return array|mixed|void
403 380
 	*/
404
-	public function fetchExpiredLicenses()
405
-	{
381
+	public function fetchExpiredLicenses() {
406 382
 		return $this->fetchLicenses(['expired' => '1']);
407 383
 	}
408 384
 
@@ -411,8 +387,7 @@  discard block
 block discarded – undo
411 387
 	* @param $xmlObj
412 388
 	* @return string|void
413 389
 	*/
414
-	public function findKey($search, $xmlObj)
415
-	{
390
+	public function findKey($search, $xmlObj) {
416 391
 		$xmlObj = (array) $xmlObj;
417 392
 		if (array_key_exists('packages', $xmlObj)) {
418 393
 			$type = 'packages';
Please login to merge, or discard this patch.