@@ -79,31 +79,31 @@ discard block |
||
79 | 79 | 'api.chunk.start' => $page * $limit |
80 | 80 | ]; |
81 | 81 | |
82 | - if ( ! empty($options['limit'])) { |
|
82 | + if (!empty($options['limit'])) { |
|
83 | 83 | $params['api.chunk.size'] = intval($options['limit']); |
84 | 84 | } |
85 | 85 | |
86 | - if ( ! empty($options['page'])) { |
|
86 | + if (!empty($options['page'])) { |
|
87 | 87 | $params['api.chunk.start'] = intval($options['page']) * $params['api.chunk.size']; |
88 | 88 | } |
89 | 89 | |
90 | - if ( ! empty($searchType) && ! in_array($searchType, ["domain", "owner", "user", "ip", "package"])) { |
|
90 | + if (!empty($searchType) && !in_array($searchType, ["domain", "owner", "user", "ip", "package"])) { |
|
91 | 91 | throw new \InvalidArgumentException("`searchType` must be one of these - domain, owner, user, ip, package"); |
92 | 92 | } |
93 | 93 | |
94 | - if ( ! empty($options['searchmethod']) && ! in_array($options['searchmethod'], ["exact", "regex"])) { |
|
94 | + if (!empty($options['searchmethod']) && !in_array($options['searchmethod'], ["exact", "regex"])) { |
|
95 | 95 | throw new \InvalidArgumentException("options[searchmethod] must be either `regex` or `exact`"); |
96 | 96 | } |
97 | 97 | |
98 | - if ( ! empty($options['want'])) { |
|
98 | + if (!empty($options['want'])) { |
|
99 | 99 | $params['want'] = $options['want']; |
100 | 100 | } |
101 | 101 | |
102 | - if ( ! empty($searchType)) { |
|
102 | + if (!empty($searchType)) { |
|
103 | 103 | $params['searchtype'] = $searchType; |
104 | 104 | } |
105 | 105 | |
106 | - if ( ! empty($keyword)) { |
|
106 | + if (!empty($keyword)) { |
|
107 | 107 | $params['search'] = $keyword; |
108 | 108 | empty($searchType) ? $params['searchtype'] = "user" : null; |
109 | 109 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | throw ClientExceptions::invalidArgument("You must provide either a username or a domain or both"); |
146 | 146 | } |
147 | 147 | |
148 | - if ( ! empty($user) && ! empty($domain)) { |
|
148 | + if (!empty($user) && !empty($domain)) { |
|
149 | 149 | throw ClientExceptions::invalidArgument( |
150 | 150 | "You must provide only one argument either user OR domain (not both)" |
151 | 151 | ); |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | |
154 | 154 | $params = []; |
155 | 155 | |
156 | - if ( ! empty($user)) { |
|
156 | + if (!empty($user)) { |
|
157 | 157 | $params['user'] = $user; |
158 | 158 | } |
159 | 159 | |
160 | - if ( ! empty($domain)) { |
|
160 | + if (!empty($domain)) { |
|
161 | 161 | $params['domain'] = $domain; |
162 | 162 | } |
163 | 163 | |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | |
169 | 169 | if ($result['status'] === 0) { |
170 | 170 | throw ClientExceptions::recordNotFound( |
171 | - ! empty($result['statusmsg']) ? $result['statusmsg'] : "Record not found" |
|
171 | + !empty($result['statusmsg']) ? $result['statusmsg'] : "Record not found" |
|
172 | 172 | ); |
173 | 173 | } |
174 | 174 | |
175 | - if ( ! empty($result['acct']) && is_array($result['acct'])) { |
|
175 | + if (!empty($result['acct']) && is_array($result['acct'])) { |
|
176 | 176 | return Account::buildFromArray($result['acct'][0]); |
177 | 177 | } |
178 | 178 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | { |
199 | 199 | $result = $this->client->sendRequest("/json-api/applist", 'GET', []); |
200 | 200 | |
201 | - if ( ! empty($result['app']) && sizeof($result['app']) > 0) { |
|
201 | + if (!empty($result['app']) && sizeof($result['app']) > 0) { |
|
202 | 202 | return $result['app']; |
203 | 203 | } |
204 | 204 | |
@@ -233,18 +233,18 @@ discard block |
||
233 | 233 | $params = []; |
234 | 234 | $params['username'] = $account->getUser(); |
235 | 235 | $params['domain'] = $account->getDomain(); |
236 | - ! empty($account->getPlanName()) ? $params['plan'] = $account->getPlanName() : null; |
|
237 | - ! empty($options['pkgname']) ? $params['pkgname'] = $options['pkgname'] : null; |
|
238 | - if ( ! empty($options['savepkg'])) { |
|
239 | - if ( ! in_array(intval($options['savepkg']), [0, 1])) { |
|
236 | + !empty($account->getPlanName()) ? $params['plan'] = $account->getPlanName() : null; |
|
237 | + !empty($options['pkgname']) ? $params['pkgname'] = $options['pkgname'] : null; |
|
238 | + if (!empty($options['savepkg'])) { |
|
239 | + if (!in_array(intval($options['savepkg']), [0, 1])) { |
|
240 | 240 | throw new ClientExceptions("`savepkg` must be either 0 or 1"); |
241 | 241 | } |
242 | 242 | |
243 | 243 | $params['savepkg'] = $options['savepkg']; |
244 | 244 | } |
245 | 245 | |
246 | - ! empty($options['featurelist']) ? $params['featurelist'] = $options['featurelist'] : null; |
|
247 | - if ( ! empty($account->getDiskLimit())) { |
|
246 | + !empty($options['featurelist']) ? $params['featurelist'] = $options['featurelist'] : null; |
|
247 | + if (!empty($account->getDiskLimit())) { |
|
248 | 248 | if ($account->getDiskLimit() === -1) { |
249 | 249 | $params['quota'] = 0; |
250 | 250 | } else { |
@@ -252,17 +252,17 @@ discard block |
||
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | - ! empty($account->getPassword()) ? $params['password'] = $account->getPassword() : null; |
|
256 | - ! empty($account->getIpAddress()) ? $params['ip'] = $account->getIpAddress() : null; |
|
257 | - ! empty($account->isCgiEnable()) ? $params['cgi'] = (int)$account->isCgiEnable() : null; |
|
258 | - ! empty($account->isSpamAssassinEnable()) ? |
|
259 | - $params['spamassassin'] = (int)$account->isSpamAssassinEnable() |
|
255 | + !empty($account->getPassword()) ? $params['password'] = $account->getPassword() : null; |
|
256 | + !empty($account->getIpAddress()) ? $params['ip'] = $account->getIpAddress() : null; |
|
257 | + !empty($account->isCgiEnable()) ? $params['cgi'] = (int) $account->isCgiEnable() : null; |
|
258 | + !empty($account->isSpamAssassinEnable()) ? |
|
259 | + $params['spamassassin'] = (int) $account->isSpamAssassinEnable() |
|
260 | 260 | : null; |
261 | - ! empty($account->isFrontPageEnable()) ? $params['frontpage'] = (int)$account->isFrontPageEnable() : null; |
|
262 | - ! empty($account->getShell()) ? $params['hasshell'] = 1 : null; |
|
263 | - ! empty($account->getEmail()) ? $params['contactemail'] = 1 : null; |
|
264 | - ! empty($account->getEmail()) ? $params['contactemail'] = 1 : null; |
|
265 | - ! empty($account->getTheme()) ? $params['cpmod'] = 1 : null; |
|
261 | + !empty($account->isFrontPageEnable()) ? $params['frontpage'] = (int) $account->isFrontPageEnable() : null; |
|
262 | + !empty($account->getShell()) ? $params['hasshell'] = 1 : null; |
|
263 | + !empty($account->getEmail()) ? $params['contactemail'] = 1 : null; |
|
264 | + !empty($account->getEmail()) ? $params['contactemail'] = 1 : null; |
|
265 | + !empty($account->getTheme()) ? $params['cpmod'] = 1 : null; |
|
266 | 266 | |
267 | 267 | if ($account->getMaxFTP() === -1) { |
268 | 268 | $params['maxftp'] = "unlimited"; |
@@ -312,18 +312,18 @@ discard block |
||
312 | 312 | $params['bwlimit'] = intval($account->getBandwidthLimit()); |
313 | 313 | } |
314 | 314 | |
315 | - ! empty($options['customip']) ? $params['customip'] = $options['customip'] : null; |
|
315 | + !empty($options['customip']) ? $params['customip'] = $options['customip'] : null; |
|
316 | 316 | |
317 | - ! empty($account->getLanguagePreference()) ? $params['language'] = $account->getLanguagePreference() : null; |
|
317 | + !empty($account->getLanguagePreference()) ? $params['language'] = $account->getLanguagePreference() : null; |
|
318 | 318 | |
319 | - ! empty($options['useregns']) ? $params['useregns'] = $options['useregns'] : null; |
|
320 | - ! empty($options['reseller']) ? $params['reseller'] = (int)$options['reseller'] : null; |
|
321 | - ! empty($options['forcedns']) ? $params['forcedns'] = (int)$options['forcedns'] : null; |
|
319 | + !empty($options['useregns']) ? $params['useregns'] = $options['useregns'] : null; |
|
320 | + !empty($options['reseller']) ? $params['reseller'] = (int) $options['reseller'] : null; |
|
321 | + !empty($options['forcedns']) ? $params['forcedns'] = (int) $options['forcedns'] : null; |
|
322 | 322 | |
323 | - ! empty($account->getMailboxFormat()) ? $params['mailbox_format'] = $account->getMailboxFormat() : null; |
|
323 | + !empty($account->getMailboxFormat()) ? $params['mailbox_format'] = $account->getMailboxFormat() : null; |
|
324 | 324 | |
325 | - if ( ! empty($options['mxcheck'])) { |
|
326 | - if ( ! in_array($options['mxcheck'], ['local', 'secondary', 'remote', 'auto'])) { |
|
325 | + if (!empty($options['mxcheck'])) { |
|
326 | + if (!in_array($options['mxcheck'], ['local', 'secondary', 'remote', 'auto'])) { |
|
327 | 327 | throw new ClientExceptions("options[mxcheck] parameters must be one of local, secondary, remote, auto"); |
328 | 328 | } |
329 | 329 | |
@@ -348,27 +348,27 @@ discard block |
||
348 | 348 | $params['max_defer_fail_percentage'] = intval($account->getMaxDeferFailMailPercentage()); |
349 | 349 | } |
350 | 350 | |
351 | - ! empty($account->getUid()) ? $params['uid'] = $account->getUid() : null; |
|
352 | - ! empty($account->getPartition()) ? $params['homedir'] = $account->getPartition() : null; |
|
353 | - ! empty($options['dkim']) ? $params['dkim'] = intval($options['dkim']) : null; |
|
354 | - ! empty($options['spf']) ? $params['spf'] = intval($options['spf']) : null; |
|
355 | - ! empty($account->getOwner()) ? $params['owner'] = $account->getOwner() : null; |
|
351 | + !empty($account->getUid()) ? $params['uid'] = $account->getUid() : null; |
|
352 | + !empty($account->getPartition()) ? $params['homedir'] = $account->getPartition() : null; |
|
353 | + !empty($options['dkim']) ? $params['dkim'] = intval($options['dkim']) : null; |
|
354 | + !empty($options['spf']) ? $params['spf'] = intval($options['spf']) : null; |
|
355 | + !empty($account->getOwner()) ? $params['owner'] = $account->getOwner() : null; |
|
356 | 356 | |
357 | 357 | $result = $this->client->sendRequest("/json-api/createacct", "GET", $params); |
358 | 358 | |
359 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 0){ |
|
359 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 0) { |
|
360 | 360 | throw new ClientExceptions($result['metadata']['reason']); |
361 | 361 | } |
362 | 362 | |
363 | - if ( ! empty($result) && ! empty($result['result'][0]) && $result['result'][0]['status'] === 0) { |
|
363 | + if (!empty($result) && !empty($result['result'][0]) && $result['result'][0]['status'] === 0) { |
|
364 | 364 | throw new ClientExceptions($result['result'][0]['statusmsg']); |
365 | 365 | } |
366 | 366 | |
367 | - if ( ! empty($result) && ! empty($result['result'][0]) && $result['result'][0]['status'] === 1) { |
|
367 | + if (!empty($result) && !empty($result['result'][0]) && $result['result'][0]['status'] === 1) { |
|
368 | 368 | return ['result' => $result['result'][0]['options'], 'raw_output' => $result['result'][0]['rawout']]; |
369 | 369 | } |
370 | 370 | |
371 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 1){ |
|
371 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
372 | 372 | return ['result' => $result['data'], 'raw_output' => $result['metadata']['output']['raw']]; |
373 | 373 | } |
374 | 374 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | $userData = $result['userdata']; |
405 | 405 | $domainUser = new DomainUser(); |
406 | - $domainUser->setHasCGI((bool)$userData['hascgi']); |
|
406 | + $domainUser->setHasCGI((bool) $userData['hascgi']); |
|
407 | 407 | $domainUser->setServerName($userData['servername']); |
408 | 408 | $domainUser->setOwner($userData['owner']); |
409 | 409 | $domainUser->setScriptAlias($userData['scriptalias']); |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $domainUser->setGroup($userData['group']); |
414 | 414 | $domainUser->setIpAddress($userData['ip']); |
415 | 415 | $domainUser->setPort($userData['port']); |
416 | - $domainUser->setPhpOpenBaseDirectoryProtect((bool)$userData['phpopenbasedirprotect']); |
|
416 | + $domainUser->setPhpOpenBaseDirectoryProtect((bool) $userData['phpopenbasedirprotect']); |
|
417 | 417 | |
418 | 418 | if ($userData['usecanonicalname'] === "Off") { |
419 | 419 | $domainUser->setUseCanonicalName(false); |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | throw new ClientExceptions($result['metadata']['reason']); |
482 | 482 | } |
483 | 483 | |
484 | - if ( ! empty($result['data'])) { |
|
484 | + if (!empty($result['data'])) { |
|
485 | 485 | return $result['updated']; |
486 | 486 | } |
487 | 487 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | return null; |
508 | 508 | } |
509 | 509 | |
510 | - if ( ! empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
510 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
511 | 511 | $domains = $result['data']['domains']; |
512 | 512 | |
513 | 513 | $domainList = []; |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | $do->setPhpVersion($domain['php_version']); |
523 | 523 | $do->setUserOwner($domain['user_owner']); |
524 | 524 | $do->setDomainType($domain['domain_type']); |
525 | - $do->setIpv6IsDedicated((bool)$domain['ipv6_is_dedicated']); |
|
525 | + $do->setIpv6IsDedicated((bool) $domain['ipv6_is_dedicated']); |
|
526 | 526 | $do->setIpv4($domain['ipv4']); |
527 | - $do->setModSecurityEnabled((bool)$domain['modsecurity_enabled']); |
|
527 | + $do->setModSecurityEnabled((bool) $domain['modsecurity_enabled']); |
|
528 | 528 | $do->setDocRoot($domain['docroot']); |
529 | 529 | $domainList[] = $do; |
530 | 530 | } |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | { |
556 | 556 | $params = ['user' => $user]; |
557 | 557 | $result = $this->client->sendRequest("/json-api/has_digest_auth", "GET", $params); |
558 | - if ( ! empty($result['data'])) { |
|
558 | + if (!empty($result['data'])) { |
|
559 | 559 | return $result['data']['digestauth'] === 1 ? true : false; |
560 | 560 | } |
561 | 561 | |
@@ -584,11 +584,11 @@ discard block |
||
584 | 584 | $params = ['user' => $user, 'password' => $password, 'digestauth' => (int) $enableDigestAuth]; |
585 | 585 | $result = $this->client->sendRequest("/json-api/set_digest_auth", "GET", $params); |
586 | 586 | |
587 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 0){ |
|
587 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 0) { |
|
588 | 588 | throw new ClientExceptions($result['metadata']['reason']); |
589 | 589 | } |
590 | 590 | |
591 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 1){ |
|
591 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
592 | 592 | return true; |
593 | 593 | } |
594 | 594 | |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | { |
611 | 611 | $params = ['user' => $user]; |
612 | 612 | $result = $this->client->sendRequest("/json-api/has_mycnf_for_cpuser", "GET", $params); |
613 | - if ( ! empty($result['data'])) { |
|
613 | + if (!empty($result['data'])) { |
|
614 | 614 | return $result['data']['has_mycnf_for_cpuser'] === 1 ? true : false; |
615 | 615 | } |
616 | 616 | |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | { |
634 | 634 | $params = ['user' => $user, 'bwlimit' => intval($bwlimit)]; |
635 | 635 | $result = $this->client->sendRequest("/json-api/limitbw", "GET", $params); |
636 | - if ( ! empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
636 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
637 | 637 | return $result['data']['bwlimits'][0]; |
638 | 638 | } |
639 | 639 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | public function getUsers() |
654 | 654 | { |
655 | 655 | $result = $this->client->sendRequest("/json-api/list_users", "GET", []); |
656 | - if ( ! empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
656 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
657 | 657 | return $result['data']['users']; |
658 | 658 | } |
659 | 659 | |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | public function getLockedAccounts() |
675 | 675 | { |
676 | 676 | $result = $this->client->sendRequest("/json-api/listlockedaccounts", "GET", []); |
677 | - if ( ! empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
677 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
678 | 678 | return $result['data']['account']; |
679 | 679 | } |
680 | 680 | |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | public function getSuspendedAccounts() |
695 | 695 | { |
696 | 696 | $result = $this->client->sendRequest("/json-api/listsuspended", "GET", []); |
697 | - if ( ! empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
697 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
698 | 698 | $suspendList = $result['data']['account']; |
699 | 699 | |
700 | 700 | $lists = []; |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | $sa = new SuspendedAccount(); |
703 | 703 | $sa->setUser($item['user']); |
704 | 704 | $sa->setOwner($item['owner']); |
705 | - $sa->setIsLocked((bool)$item['is_locked']); |
|
705 | + $sa->setIsLocked((bool) $item['is_locked']); |
|
706 | 706 | $sa->setReason($item['reason']); |
707 | 707 | $sa->setTime(DateTime::createFromFormat("D M j H:i:s Y", $item['time'])); |
708 | 708 | $lists[] = $sa; |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | */ |
732 | 732 | public function modifyAccount(Account $account) |
733 | 733 | { |
734 | - if(empty($account->getUser())){ |
|
734 | + if (empty($account->getUser())) { |
|
735 | 735 | throw ClientExceptions::invalidArgument("You must provide username to modify account"); |
736 | 736 | } |
737 | 737 | |
@@ -739,103 +739,103 @@ discard block |
||
739 | 739 | 'user' => $account->getUser() |
740 | 740 | ]; |
741 | 741 | |
742 | - if($account->isBackupEnabled()){ |
|
742 | + if ($account->isBackupEnabled()) { |
|
743 | 743 | $params['BACKUP'] = 1; |
744 | 744 | } |
745 | 745 | |
746 | - if($account->getBandwidthLimit() === -1){ |
|
746 | + if ($account->getBandwidthLimit() === -1) { |
|
747 | 747 | $params['BWLIMIT'] = "unlimited"; |
748 | 748 | } |
749 | 749 | |
750 | - if(!empty($account->getDomain())){ |
|
750 | + if (!empty($account->getDomain())) { |
|
751 | 751 | $params['DNS'] = $account->getDomain(); |
752 | 752 | } |
753 | 753 | |
754 | - if(!empty($account->isCgiEnable())){ |
|
754 | + if (!empty($account->isCgiEnable())) { |
|
755 | 755 | $params['HASCGI'] = (int) $account->isCgiEnable(); |
756 | 756 | } |
757 | 757 | |
758 | - if(!empty($account->getMaxAddonDomains())){ |
|
758 | + if (!empty($account->getMaxAddonDomains())) { |
|
759 | 759 | $params['MAXADDON'] = $account->getMaxAddonDomains() === -1 ? "unlimited" : intval($account->getMaxAddonDomains()); |
760 | 760 | } |
761 | 761 | |
762 | - if(!empty($account->getMaxFTP())){ |
|
762 | + if (!empty($account->getMaxFTP())) { |
|
763 | 763 | $params['MAXFTP'] = $account->getMaxFTP() === -1 ? "unlimited" : intval($account->getMaxFTP()); |
764 | 764 | } |
765 | 765 | |
766 | - if(!empty($account->getMaxMailingList())){ |
|
766 | + if (!empty($account->getMaxMailingList())) { |
|
767 | 767 | $params['MAXLST'] = $account->getMaxMailingList() === -1 ? "unlimited" : intval($account->getMaxMailingList()); |
768 | 768 | } |
769 | 769 | |
770 | - if(!empty($account->getMaxParkedDomains())){ |
|
770 | + if (!empty($account->getMaxParkedDomains())) { |
|
771 | 771 | $params['MAXPARK'] = $account->getMaxParkedDomains() === -1 ? "unlimited" : intval($account->getMaxParkedDomains()); |
772 | 772 | } |
773 | 773 | |
774 | - if(!empty($account->getMaxPOP())){ |
|
774 | + if (!empty($account->getMaxPOP())) { |
|
775 | 775 | $params['MAXPOP'] = $account->getMaxPOP() === -1 ? "unlimited" : null; |
776 | 776 | } |
777 | 777 | |
778 | - if(!empty($account->getMaxSQL())){ |
|
778 | + if (!empty($account->getMaxSQL())) { |
|
779 | 779 | $params['MAXSQL'] = $account->getMaxSQL() === -1 ? "unlimited" : intval($account->getMaxSQL()); |
780 | 780 | } |
781 | 781 | |
782 | - if(!empty($account->getMaxSubDomain())){ |
|
782 | + if (!empty($account->getMaxSubDomain())) { |
|
783 | 783 | $params['MAXSUB'] = $account->getMaxSubDomain() === -1 ? "unlimited" : intval($account->getMaxSubDomain()); |
784 | 784 | } |
785 | 785 | |
786 | - if(!empty($account->getMaxEmailPerHour())){ |
|
786 | + if (!empty($account->getMaxEmailPerHour())) { |
|
787 | 787 | $params['MAX_EMAIL_PER_HOUR'] = $account->getMaxEmailPerHour() === -1 ? "unlimited" : intval($account->getMaxEmailPerHour()); |
788 | 788 | } |
789 | - if(!empty($account->getMaxEmailAccountQuota())){ |
|
789 | + if (!empty($account->getMaxEmailAccountQuota())) { |
|
790 | 790 | $params['MAX_EMAILACCT_QUOTA'] = $account->getMaxEmailAccountQuota() === -1 ? "unlimited" : intval($account->getMaxDeferFailMailPercentage()); |
791 | 791 | } |
792 | 792 | |
793 | - if(!empty($account->getMaxDeferFailMailPercentage())){ |
|
793 | + if (!empty($account->getMaxDeferFailMailPercentage())) { |
|
794 | 794 | $params['MAX_DEFER_FAIL_PERCENTAGE'] = $account->getMaxDeferFailMailPercentage() === -1 ? "unlimited" : intval($account->getMaxDeferFailMailPercentage()); |
795 | 795 | } |
796 | 796 | |
797 | - if(!empty($account->getOwner())){ |
|
797 | + if (!empty($account->getOwner())) { |
|
798 | 798 | $params['owner'] = $account->getOwner(); |
799 | 799 | } |
800 | 800 | |
801 | - if(!empty($account->getDiskLimit())){ |
|
801 | + if (!empty($account->getDiskLimit())) { |
|
802 | 802 | $params['QUOTA'] = $account->getDiskLimit() === -1 ? "unlimited" : intval($account->getDiskLimit()); |
803 | 803 | } |
804 | 804 | |
805 | - if($account->isSpamAssassinEnable()){ |
|
805 | + if ($account->isSpamAssassinEnable()) { |
|
806 | 806 | $params['spamassassin'] = (int) $account->isSpamAssassinEnable(); |
807 | 807 | } |
808 | 808 | |
809 | - if($account->isFrontPageEnable()){ |
|
809 | + if ($account->isFrontPageEnable()) { |
|
810 | 810 | $params['frontpage'] = (int) $account->isFrontPageEnable(); |
811 | 811 | } |
812 | 812 | |
813 | - if(!empty($account->getTheme())){ |
|
813 | + if (!empty($account->getTheme())) { |
|
814 | 814 | $params['RS'] = $account->getTheme(); |
815 | 815 | } |
816 | 816 | |
817 | - if(!empty($account->getIpAddress())){ |
|
817 | + if (!empty($account->getIpAddress())) { |
|
818 | 818 | $params['IP'] = $account->getIpAddress(); |
819 | 819 | } |
820 | 820 | |
821 | - if(!empty($account->getLanguagePreference())){ |
|
821 | + if (!empty($account->getLanguagePreference())) { |
|
822 | 822 | $params['LANG'] = $account->getLanguagePreference(); |
823 | 823 | } |
824 | 824 | |
825 | - if(!empty($account->getMailboxFormat())){ |
|
825 | + if (!empty($account->getMailboxFormat())) { |
|
826 | 826 | $params['MAILBOX_FORMAT'] = $account->getMailboxFormat(); |
827 | 827 | } |
828 | 828 | |
829 | - if(is_bool($account->isOutgoingMailSuspended())){ |
|
829 | + if (is_bool($account->isOutgoingMailSuspended())) { |
|
830 | 830 | $params['OUTGOING_EMAIL_SUSPENDED'] = (int) $account->isOutgoingMailSuspended(); |
831 | 831 | } |
832 | 832 | |
833 | 833 | $result = $this->client->sendRequest("/json-api/modifyacct", "GET", $params); |
834 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 1){ |
|
834 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
835 | 835 | return true; |
836 | 836 | } |
837 | 837 | |
838 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 0){ |
|
838 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 0) { |
|
839 | 839 | throw new ClientExceptions($result['metadata']['reason']); |
840 | 840 | } |
841 | 841 | |
@@ -862,21 +862,21 @@ discard block |
||
862 | 862 | 'password' => $newPassword |
863 | 863 | ]; |
864 | 864 | |
865 | - if(isset($digestAuth)){ |
|
865 | + if (isset($digestAuth)) { |
|
866 | 866 | $params['digestauth'] = (int) $digestAuth; |
867 | 867 | } |
868 | 868 | |
869 | - if(isset($dbPassUpdate)){ |
|
869 | + if (isset($dbPassUpdate)) { |
|
870 | 870 | $params['db_pass_update'] = (int) $dbPassUpdate; |
871 | 871 | } |
872 | 872 | |
873 | 873 | $result = $this->client->sendRequest("/json-api/passwd", "GET", $params); |
874 | 874 | |
875 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 0){ |
|
875 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 0) { |
|
876 | 876 | throw new ClientExceptions($result['metadata']['reason']); |
877 | 877 | } |
878 | 878 | |
879 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 1){ |
|
879 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
880 | 880 | return $result['data']['app']; |
881 | 881 | } |
882 | 882 | |
@@ -900,11 +900,11 @@ discard block |
||
900 | 900 | $params = ['user' => $username, 'keepdns' => (int) $keepDNS]; |
901 | 901 | $result = $this->client->sendRequest("/json-api/removeacct", "GET", $params); |
902 | 902 | |
903 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 0){ |
|
903 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 0) { |
|
904 | 904 | throw new ClientExceptions($result['metadata']['reason']); |
905 | 905 | } |
906 | 906 | |
907 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 1){ |
|
907 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
908 | 908 | return true; |
909 | 909 | } |
910 | 910 | |
@@ -929,44 +929,44 @@ discard block |
||
929 | 929 | public function getBandwidthInfo($month = null, $year = null, $resellerUsername = null, $searchKeyword = null, $searchType = null) |
930 | 930 | { |
931 | 931 | $params = []; |
932 | - if(!empty($searchKeyword)){ |
|
932 | + if (!empty($searchKeyword)) { |
|
933 | 933 | $params['search'] = $searchKeyword; |
934 | 934 | } |
935 | 935 | |
936 | - if(!empty($searchType) && !in_array($searchType, ["domain", "user", "owner", "ip", "package"])){ |
|
936 | + if (!empty($searchType) && !in_array($searchType, ["domain", "user", "owner", "ip", "package"])) { |
|
937 | 937 | throw new ClientExceptions("searchType must be one of domain, user, owner, ip and package"); |
938 | 938 | } |
939 | 939 | |
940 | - if(!empty($searchType)){ |
|
940 | + if (!empty($searchType)) { |
|
941 | 941 | $params['searchtype'] = $searchType; |
942 | 942 | } |
943 | 943 | |
944 | - if(!empty($month) && !is_int($month)){ |
|
944 | + if (!empty($month) && !is_int($month)) { |
|
945 | 945 | throw new ClientExceptions("month must be an integer"); |
946 | 946 | } |
947 | - if(!empty($month)){ |
|
947 | + if (!empty($month)) { |
|
948 | 948 | $params['month'] = intval($month); |
949 | 949 | } |
950 | 950 | |
951 | - if(!empty($year) && !is_int($year)){ |
|
951 | + if (!empty($year) && !is_int($year)) { |
|
952 | 952 | throw new ClientExceptions("year must be an integer"); |
953 | 953 | } |
954 | 954 | |
955 | - if(!empty($year)){ |
|
955 | + if (!empty($year)) { |
|
956 | 956 | $params['year'] = intval($year); |
957 | 957 | } |
958 | 958 | |
959 | - if(!empty($resellerUsername)){ |
|
959 | + if (!empty($resellerUsername)) { |
|
960 | 960 | $params['showres'] = $resellerUsername; |
961 | 961 | } |
962 | 962 | |
963 | 963 | $result = $this->client->sendRequest("/json-api/showbw", "GET", $params); |
964 | 964 | |
965 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 0){ |
|
965 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 0) { |
|
966 | 966 | throw new ClientExceptions($result['metadata']['reason']); |
967 | 967 | } |
968 | 968 | |
969 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
969 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
970 | 970 | return $result['data']['acct']; |
971 | 971 | } |
972 | 972 | |
@@ -991,11 +991,11 @@ discard block |
||
991 | 991 | $params = ['user' => $user, 'reason' => $reason, 'disallowun' => (int) $disallowUnsuspension]; |
992 | 992 | $result = $this->client->sendRequest("/json-api/suspendacct", "GET", $params); |
993 | 993 | |
994 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 0){ |
|
994 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 0) { |
|
995 | 995 | throw new ClientExceptions($result['metadata']['reason']); |
996 | 996 | } |
997 | 997 | |
998 | - if(!empty($result['metadata']) && $result['metadata']['result'] === 1){ |
|
998 | + if (!empty($result['metadata']) && $result['metadata']['result'] === 1) { |
|
999 | 999 | return true; |
1000 | 1000 | } |
1001 | 1001 |