Test Failed
Pull Request — master (#1)
by
unknown
08:08 queued 05:23
created
src/Cpanel.php 1 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.