Test Failed
Push — master ( f8fe91...e2870e )
by Joe
04:30
created
src/Cpanel.php 2 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 	public $opts;
15 15
 
16 16
 	/**
17
-	* Cpanel constructor.
18
-	*
19
-	* @param $user
20
-	* @param $pass
21
-	*/
17
+	 * Cpanel constructor.
18
+	 *
19
+	 * @param $user
20
+	 * @param $pass
21
+	 */
22 22
 	public function __construct($user, $pass)
23 23
 	{
24 24
 		$this->opts = [];
@@ -29,29 +29,29 @@  discard block
 block discarded – undo
29 29
 	}
30 30
 
31 31
 	/**
32
-	* @param $option
33
-	* @param $value
34
-	*/
32
+	 * @param $option
33
+	 * @param $value
34
+	 */
35 35
 	public function setopt($option, $value)
36 36
 	{
37 37
 		$this->opts[$option] = $value;
38 38
 	}
39 39
 
40 40
 	/**
41
-	* sets the login credentials
42
-	* @param string $user the username
43
-	* @param string $pass the password
44
-	*/
41
+	 * sets the login credentials
42
+	 * @param string $user the username
43
+	 * @param string $pass the password
44
+	 */
45 45
 	public function setCredentials($user, $pass)
46 46
 	{
47 47
 		$this->setopt(CURLOPT_USERPWD, $user.':'.$pass);
48 48
 	}
49 49
 
50 50
 	/**
51
-	* sets the output format
52
-	*
53
-	* @param string $format can be any of xml,json,yaml,simplexml
54
-	*/
51
+	 * sets the output format
52
+	 *
53
+	 * @param string $format can be any of xml,json,yaml,simplexml
54
+	 */
55 55
 	public function setFormat($format)
56 56
 	{
57 57
 		if ($format != 'xml' && $format != 'json' && $format != 'yaml' && $format != 'simplexml') {
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 
65 65
 	/**
66
-	* @param string $function
67
-	* @param array $args
68
-	* @return array|mixed|void
69
-	*/
66
+	 * @param string $function
67
+	 * @param array $args
68
+	 * @return array|mixed|void
69
+	 */
70 70
 	private function get($function, $args = [])
71 71
 	{
72 72
 		if (!$function) {
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 	}
104 104
 
105 105
 	/**
106
-	* formats the response
107
-	* @param array $result the result array to format
108
-	* @return array the rormatted arrray
109
-	*/
106
+	 * formats the response
107
+	 * @param array $result the result array to format
108
+	 * @return array the rormatted arrray
109
+	 */
110 110
 	private function formatResult($result)
111 111
 	{
112 112
 		if (is_array($result)) {
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 	}
125 125
 
126 126
 	/**
127
-	* @param $id
128
-	* @return int
129
-	*/
127
+	 * @param $id
128
+	 * @return int
129
+	 */
130 130
 	private function validateID($id)
131 131
 	{
132 132
 		if (preg_match("/^(L|P|G)?\d*$/", $id)) {
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
137 137
 	}
138 138
 
139 139
 	/**
140
-	* @param $ipAddress
141
-	* @return int
142
-	*/
140
+	 * @param $ipAddress
141
+	 * @return int
142
+	 */
143 143
 	private function validateIP($ipAddress)
144 144
 	{
145 145
 		return preg_match("/^\d*\.\d*\.\d*\.\d*$/", $ipAddress);
146 146
 	}
147 147
 
148 148
 	/**
149
-	* @param $args
150
-	* @return array|mixed|void
151
-	*/
149
+	 * @param $args
150
+	 * @return array|mixed|void
151
+	 */
152 152
 	public function reactivateLicense($args)
153 153
 	{
154 154
 		if (!array_key_exists('liscid', $args)) {
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 	}
164 164
 
165 165
 	/**
166
-	* @param $args
167
-	* @return array|mixed|void
168
-	*/
166
+	 * @param $args
167
+	 * @return array|mixed|void
168
+	 */
169 169
 	public function expireLicense($args)
170 170
 	{
171 171
 		if (!array_key_exists('liscid', $args)) {
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
 	}
181 181
 
182 182
 	/**
183
-	* @param $args
184
-	* @return array|mixed|void
185
-	*/
183
+	 * @param $args
184
+	 * @return array|mixed|void
185
+	 */
186 186
 	public function extendOnetimeUpdates($args)
187 187
 	{
188 188
 		if (!array_key_exists('ip', $args)) {
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
 	}
198 198
 
199 199
 	/**
200
-	* @param $args
201
-	* @return array|mixed|void
202
-	*/
200
+	 * @param $args
201
+	 * @return array|mixed|void
202
+	 */
203 203
 	public function changeip($args)
204 204
 	{
205 205
 		if (!array_key_exists('oldip', $args) || !array_key_exists('newip', $args)) {
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
 	}
215 215
 
216 216
 	/**
217
-	* @param $args
218
-	* @return array|mixed|void
219
-	*/
217
+	 * @param $args
218
+	 * @return array|mixed|void
219
+	 */
220 220
 	public function requestTransfer($args)
221 221
 	{
222 222
 		if (!array_key_exists('ip', $args) || !array_key_exists('groupid', $args) || !array_key_exists('packagegroup', $args)) {
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
 	}
240 240
 
241 241
 	/**
242
-	* @param $args
243
-	* @return array|mixed|void
244
-	*/
242
+	 * @param $args
243
+	 * @return array|mixed|void
244
+	 */
245 245
 	public function activateLicense($args)
246 246
 	{
247 247
 		if (!array_key_exists('ip', $args) || !array_key_exists('groupid', $args) || !array_key_exists('packageid', $args)) {
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 	}
266 266
 
267 267
 	/**
268
-	* @param $args
269
-	* @return array|mixed|void
270
-	*/
268
+	 * @param $args
269
+	 * @return array|mixed|void
270
+	 */
271 271
 	public function addPickupPass($args)
272 272
 	{
273 273
 		if (!array_key_exists('pickup', $args)) {
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
 	}
279 279
 
280 280
 	/**
281
-	* @param $args
282
-	* @return array|mixed|void
283
-	*/
281
+	 * @param $args
282
+	 * @return array|mixed|void
283
+	 */
284 284
 	public function registerAuth($args)
285 285
 	{
286 286
 		if (!array_key_exists('user', $args)) {
@@ -303,21 +303,21 @@  discard block
 block discarded – undo
303 303
 	}
304 304
 
305 305
 	/**
306
-	* return s a list of groups
307
-	*
308
-	* @return array|mixed|void
309
-	*/
306
+	 * return s a list of groups
307
+	 *
308
+	 * @return array|mixed|void
309
+	 */
310 310
 	public function fetchGroups()
311 311
 	{
312 312
 		return $this->get('XMLgroupInfo.cgi');
313 313
 	}
314 314
 
315 315
 	/**
316
-	* fetches license risk data
317
-	*
318
-	* @param array $args
319
-	* @return array|mixed|void
320
-	*/
316
+	 * fetches license risk data
317
+	 *
318
+	 * @param array $args
319
+	 * @return array|mixed|void
320
+	 */
321 321
 	public function fetchLicenseRiskData($args = [])
322 322
 	{
323 323
 		if (!array_key_exists('ip', $args)) {
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
 	}
333 333
 
334 334
 	/**
335
-	* gets raw license information
336
-	*
337
-	* @param array $args optional array of arguments
338
-	* @return array|mixed|void
339
-	*/
335
+	 * gets raw license information
336
+	 *
337
+	 * @param array $args optional array of arguments
338
+	 * @return array|mixed|void
339
+	 */
340 340
 	public function fetchLicenseRaw($args = [])
341 341
 	{
342 342
 		$args = array_merge(['all' => 1], $args);
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
 	}
353 353
 
354 354
 	/**
355
-	* gets license information
356
-	*
357
-	* @param array $args optional array of arguments
358
-	* @return array|mixed|void
359
-	*/
355
+	 * gets license information
356
+	 *
357
+	 * @param array $args optional array of arguments
358
+	 * @return array|mixed|void
359
+	 */
360 360
 	public function fetchLicenseId($args = [])
361 361
 	{
362 362
 		$args = array_merge(['all' => 1], $args);
@@ -372,38 +372,38 @@  discard block
 block discarded – undo
372 372
 	}
373 373
 
374 374
 	/**
375
-	* @return array|mixed|void
376
-	*/
375
+	 * @return array|mixed|void
376
+	 */
377 377
 	public function fetchPackages()
378 378
 	{
379 379
 		return $this->get('XMLpackageInfo.cgi');
380 380
 	}
381 381
 
382 382
 	/**
383
-	* gets a list of licenses
384
-	*
385
-	* @param array $args optional arguments
386
-	* @return array|mixed|void
387
-	*/
383
+	 * gets a list of licenses
384
+	 *
385
+	 * @param array $args optional arguments
386
+	 * @return array|mixed|void
387
+	 */
388 388
 	public function fetchLicenses($args = [])
389 389
 	{
390 390
 		return $this->get('XMLlicenseInfo.cgi');
391 391
 	}
392 392
 
393 393
 	/**
394
-	* return sa list of expired licenses
395
-	* @return array|mixed|void
396
-	*/
394
+	 * return sa list of expired licenses
395
+	 * @return array|mixed|void
396
+	 */
397 397
 	public function fetchExpiredLicenses()
398 398
 	{
399 399
 		return $this->fetchLicenses(['expired' => '1']);
400 400
 	}
401 401
 
402 402
 	/**
403
-	* @param $search
404
-	* @param $xmlObj
405
-	* @return string|void
406
-	*/
403
+	 * @param $search
404
+	 * @param $xmlObj
405
+	 * @return string|void
406
+	 */
407 407
 	public function findKey($search, $xmlObj)
408 408
 	{
409 409
 		$xmlObj = (array) $xmlObj;
Please login to merge, or discard this patch.
Braces   +25 added lines, -50 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  * @package Detain\Cpanel
9 9
  */
10
-class Cpanel
11
-{
10
+class Cpanel {
12 11
 	public $format;
13 12
 	public $curl;
14 13
 	public $opts;
@@ -19,8 +18,7 @@  discard block
 block discarded – undo
19 18
 	* @param $user
20 19
 	* @param $pass
21 20
 	*/
22
-	public function __construct($user, $pass)
23
-	{
21
+	public function __construct($user, $pass) {
24 22
 		$this->opts = [];
25 23
 		$this->format = 'simplexml';
26 24
 		$this->setCredentials($user, $pass);
@@ -32,8 +30,7 @@  discard block
 block discarded – undo
32 30
 	* @param $option
33 31
 	* @param $value
34 32
 	*/
35
-	public function setopt($option, $value)
36
-	{
33
+	public function setopt($option, $value) {
37 34
 		$this->opts[$option] = $value;
38 35
 	}
39 36
 
@@ -42,8 +39,7 @@  discard block
 block discarded – undo
42 39
 	* @param string $user the username
43 40
 	* @param string $pass the password
44 41
 	*/
45
-	public function setCredentials($user, $pass)
46
-	{
42
+	public function setCredentials($user, $pass) {
47 43
 		$this->setopt(CURLOPT_USERPWD, $user.':'.$pass);
48 44
 	}
49 45
 
@@ -52,8 +48,7 @@  discard block
 block discarded – undo
52 48
 	*
53 49
 	* @param string $format can be any of xml,json,yaml,simplexml
54 50
 	*/
55
-	public function setFormat($format)
56
-	{
51
+	public function setFormat($format) {
57 52
 		if ($format != 'xml' && $format != 'json' && $format != 'yaml' && $format != 'simplexml') {
58 53
 			error_log('setFormat requires that the format is xml, json, yaml or simplexml');
59 54
 			return;
@@ -67,8 +62,7 @@  discard block
 block discarded – undo
67 62
 	* @param array $args
68 63
 	* @return array|mixed|void
69 64
 	*/
70
-	private function get($function, $args = [])
71
-	{
65
+	private function get($function, $args = []) {
72 66
 		if (!$function) {
73 67
 			error_log('cPanelLicensing::get requires that a function is defined');
74 68
 			return;
@@ -107,8 +101,7 @@  discard block
 block discarded – undo
107 101
 	* @param array $result the result array to format
108 102
 	* @return array the rormatted arrray
109 103
 	*/
110
-	private function formatResult($result)
111
-	{
104
+	private function formatResult($result) {
112 105
 		if (is_array($result)) {
113 106
 			foreach ($result as $key => $value) {
114 107
 				if (is_array($value)) {
@@ -127,8 +120,7 @@  discard block
 block discarded – undo
127 120
 	* @param $id
128 121
 	* @return int
129 122
 	*/
130
-	private function validateID($id)
131
-	{
123
+	private function validateID($id) {
132 124
 		if (preg_match("/^(L|P|G)?\d*$/", $id)) {
133 125
 			return 1;
134 126
 		} else {
@@ -140,8 +132,7 @@  discard block
 block discarded – undo
140 132
 	* @param $ipAddress
141 133
 	* @return int
142 134
 	*/
143
-	private function validateIP($ipAddress)
144
-	{
135
+	private function validateIP($ipAddress) {
145 136
 		return preg_match("/^\d*\.\d*\.\d*\.\d*$/", $ipAddress);
146 137
 	}
147 138
 
@@ -149,8 +140,7 @@  discard block
 block discarded – undo
149 140
 	* @param $args
150 141
 	* @return array|mixed|void
151 142
 	*/
152
-	public function reactivateLicense($args)
153
-	{
143
+	public function reactivateLicense($args) {
154 144
 		if (!array_key_exists('liscid', $args)) {
155 145
 			error_log('cpanelLicensing::reactivateLicense requires that the argument array contains element liscid');
156 146
 			return;
@@ -166,8 +156,7 @@  discard block
 block discarded – undo
166 156
 	* @param $args
167 157
 	* @return array|mixed|void
168 158
 	*/
169
-	public function expireLicense($args)
170
-	{
159
+	public function expireLicense($args) {
171 160
 		if (!array_key_exists('liscid', $args)) {
172 161
 			error_log('cPanelLicensing::expireLicense requires that liscid elements exists in the array passed to it');
173 162
 			return;
@@ -183,8 +172,7 @@  discard block
 block discarded – undo
183 172
 	* @param $args
184 173
 	* @return array|mixed|void
185 174
 	*/
186
-	public function extendOnetimeUpdates($args)
187
-	{
175
+	public function extendOnetimeUpdates($args) {
188 176
 		if (!array_key_exists('ip', $args)) {
189 177
 			error_log('cpanelLicensing::extendOnetimeUpdates requires that the element ip exists in the array is passed to it');
190 178
 			return;
@@ -200,8 +188,7 @@  discard block
 block discarded – undo
200 188
 	* @param $args
201 189
 	* @return array|mixed|void
202 190
 	*/
203
-	public function changeip($args)
204
-	{
191
+	public function changeip($args) {
205 192
 		if (!array_key_exists('oldip', $args) || !array_key_exists('newip', $args)) {
206 193
 			error_log('cpanelLicensing::changeip requires that oldip and newip elements exist in the array passed to it');
207 194
 			return;
@@ -217,8 +204,7 @@  discard block
 block discarded – undo
217 204
 	* @param $args
218 205
 	* @return array|mixed|void
219 206
 	*/
220
-	public function requestTransfer($args)
221
-	{
207
+	public function requestTransfer($args) {
222 208
 		if (!array_key_exists('ip', $args) || !array_key_exists('groupid', $args) || !array_key_exists('packagegroup', $args)) {
223 209
 			error_log('cpanelLicensing::requestTransfer requires that ip, groupid and packageid elements exist in the array passed to it');
224 210
 			return;
@@ -242,8 +228,7 @@  discard block
 block discarded – undo
242 228
 	* @param $args
243 229
 	* @return array|mixed|void
244 230
 	*/
245
-	public function activateLicense($args)
246
-	{
231
+	public function activateLicense($args) {
247 232
 		if (!array_key_exists('ip', $args) || !array_key_exists('groupid', $args) || !array_key_exists('packageid', $args)) {
248 233
 			error_log('cpanelLicensing::activateLicense requires that ip, groupid and packageid elements exist in the array passed to it');
249 234
 			return;
@@ -268,8 +253,7 @@  discard block
 block discarded – undo
268 253
 	* @param $args
269 254
 	* @return array|mixed|void
270 255
 	*/
271
-	public function addPickupPass($args)
272
-	{
256
+	public function addPickupPass($args) {
273 257
 		if (!array_key_exists('pickup', $args)) {
274 258
 			error_log('cPanelLicensing::addPickupPass requires a pickup param');
275 259
 			return;
@@ -281,8 +265,7 @@  discard block
 block discarded – undo
281 265
 	* @param $args
282 266
 	* @return array|mixed|void
283 267
 	*/
284
-	public function registerAuth($args)
285
-	{
268
+	public function registerAuth($args) {
286 269
 		if (!array_key_exists('user', $args)) {
287 270
 			error_log('cPanelLicensing::registerAuth requires a user param');
288 271
 			return;
@@ -307,8 +290,7 @@  discard block
 block discarded – undo
307 290
 	*
308 291
 	* @return array|mixed|void
309 292
 	*/
310
-	public function fetchGroups()
311
-	{
293
+	public function fetchGroups() {
312 294
 		return $this->get('XMLgroupInfo.cgi');
313 295
 	}
314 296
 
@@ -318,8 +300,7 @@  discard block
 block discarded – undo
318 300
 	* @param array $args
319 301
 	* @return array|mixed|void
320 302
 	*/
321
-	public function fetchLicenseRiskData($args = [])
322
-	{
303
+	public function fetchLicenseRiskData($args = []) {
323 304
 		if (!array_key_exists('ip', $args)) {
324 305
 			error_log('cpanelLicensing::fetchLicenseRiskData requires that ip exists as an element in the array is passed to it');
325 306
 			return;
@@ -337,8 +318,7 @@  discard block
 block discarded – undo
337 318
 	* @param array $args optional array of arguments
338 319
 	* @return array|mixed|void
339 320
 	*/
340
-	public function fetchLicenseRaw($args = [])
341
-	{
321
+	public function fetchLicenseRaw($args = []) {
342 322
 		$args = array_merge(['all' => 1], $args);
343 323
 		if (!array_key_exists('ip', $args)) {
344 324
 			error_log('cpanelLicesning::fetchLicenseRaw requires that ip exists as an element in the array is passed to it');
@@ -357,8 +337,7 @@  discard block
 block discarded – undo
357 337
 	* @param array $args optional array of arguments
358 338
 	* @return array|mixed|void
359 339
 	*/
360
-	public function fetchLicenseId($args = [])
361
-	{
340
+	public function fetchLicenseId($args = []) {
362 341
 		$args = array_merge(['all' => 1], $args);
363 342
 		if (!array_key_exists('ip', $args)) {
364 343
 			error_log('cpanelLicensing::getLicenseId requires that an IP is passed to it');
@@ -374,8 +353,7 @@  discard block
 block discarded – undo
374 353
 	/**
375 354
 	* @return array|mixed|void
376 355
 	*/
377
-	public function fetchPackages()
378
-	{
356
+	public function fetchPackages() {
379 357
 		return $this->get('XMLpackageInfo.cgi');
380 358
 	}
381 359
 
@@ -385,8 +363,7 @@  discard block
 block discarded – undo
385 363
 	* @param array $args optional arguments
386 364
 	* @return array|mixed|void
387 365
 	*/
388
-	public function fetchLicenses($args = [])
389
-	{
366
+	public function fetchLicenses($args = []) {
390 367
 		return $this->get('XMLlicenseInfo.cgi');
391 368
 	}
392 369
 
@@ -394,8 +371,7 @@  discard block
 block discarded – undo
394 371
 	* return sa list of expired licenses
395 372
 	* @return array|mixed|void
396 373
 	*/
397
-	public function fetchExpiredLicenses()
398
-	{
374
+	public function fetchExpiredLicenses() {
399 375
 		return $this->fetchLicenses(['expired' => '1']);
400 376
 	}
401 377
 
@@ -404,8 +380,7 @@  discard block
 block discarded – undo
404 380
 	* @param $xmlObj
405 381
 	* @return string|void
406 382
 	*/
407
-	public function findKey($search, $xmlObj)
408
-	{
383
+	public function findKey($search, $xmlObj) {
409 384
 		$xmlObj = (array) $xmlObj;
410 385
 		if (array_key_exists('packages', $xmlObj)) {
411 386
 			$type = 'packages';
Please login to merge, or discard this patch.