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