Passed
Push — master ( 958bcd...66ff0d )
by Shaharia
02:32 queued 01:05
created
src/Entity/Account.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1119,7 +1119,7 @@
 block discarded – undo
1119 1119
 
1120 1120
         $ac->setInodeUsed(intval($account['inodesused']));
1121 1121
 
1122
-        if (! empty($account['has_backup'])) {
1122
+        if (!empty($account['has_backup'])) {
1123 1123
             $ac->setBackup((bool)$account['has_backup']);
1124 1124
         }
1125 1125
 
Please login to merge, or discard this patch.
src/WHM/Accounts.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -79,31 +79,31 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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()) ?
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 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
 block discarded – undo
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,19 +348,19 @@  discard block
 block discarded – undo
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) && ! empty($result['result'][0]) && $result['result'][0]['status'] === 0) {
359
+        if (!empty($result) && !empty($result['result'][0]) && $result['result'][0]['status'] === 0) {
360 360
             throw new ClientExceptions($result['result'][0]['statusmsg']);
361 361
         }
362 362
 
363
-        if ( ! empty($result) && ! empty($result['result'][0]) && $result['result'][0]['status'] === 1) {
363
+        if (!empty($result) && !empty($result['result'][0]) && $result['result'][0]['status'] === 1) {
364 364
             return ['result' => $result['result'][0]['options'], 'raw_output' => $result['result'][0]['rawout']];
365 365
         }
366 366
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
             throw new ClientExceptions($result['metadata']['reason']);
474 474
         }
475 475
 
476
-        if ( ! empty($result['data'])) {
476
+        if (!empty($result['data'])) {
477 477
             return $result['updated'];
478 478
         }
479 479
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
             return null;
500 500
         }
501 501
 
502
-        if ( ! empty($result['metadata']) && $result['metadata']['result'] === 1) {
502
+        if (!empty($result['metadata']) && $result['metadata']['result'] === 1) {
503 503
             $domains = $result['data']['domains'];
504 504
 
505 505
             $domainList = [];
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
     {
548 548
         $params = ['user' => $user];
549 549
         $result = $this->client->sendRequest("/json-api/has_digest_auth", "GET", $params);
550
-        if ( ! empty($result['data'])) {
550
+        if (!empty($result['data'])) {
551 551
             return $result['data']['digestauth'] === 1 ? true : false;
552 552
         }
553 553
 
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
     {
570 570
         $params = ['user' => $user];
571 571
         $result = $this->client->sendRequest("/json-api/has_mycnf_for_cpuser", "GET", $params);
572
-        if ( ! empty($result['data'])) {
572
+        if (!empty($result['data'])) {
573 573
             return $result['data']['has_mycnf_for_cpuser'] === 1 ? true : false;
574 574
         }
575 575
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
     {
593 593
         $params = ['user' => $user, 'bwlimit' => intval($bwlimit)];
594 594
         $result = $this->client->sendRequest("/json-api/limitbw", "GET", $params);
595
-        if ( ! empty($result['metadata']) && $result['metadata']['result'] === 1) {
595
+        if (!empty($result['metadata']) && $result['metadata']['result'] === 1) {
596 596
             return $result['data']['bwlimits'][0];
597 597
         }
598 598
 
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
     public function getUsers()
613 613
     {
614 614
         $result = $this->client->sendRequest("/json-api/list_users", "GET", []);
615
-        if ( ! empty($result['metadata']) && $result['metadata']['result'] === 1) {
615
+        if (!empty($result['metadata']) && $result['metadata']['result'] === 1) {
616 616
             return $result['data']['users'];
617 617
         }
618 618
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
     public function getLockedAccounts()
634 634
     {
635 635
         $result = $this->client->sendRequest("/json-api/listlockedaccounts", "GET", []);
636
-        if ( ! empty($result['metadata']) && $result['metadata']['result'] === 1) {
636
+        if (!empty($result['metadata']) && $result['metadata']['result'] === 1) {
637 637
             return $result['data']['account'];
638 638
         }
639 639
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
     public function getSuspendedAccounts()
654 654
     {
655 655
         $result = $this->client->sendRequest("/json-api/listsuspended", "GET", []);
656
-        if ( ! empty($result['metadata']) && $result['metadata']['result'] === 1) {
656
+        if (!empty($result['metadata']) && $result['metadata']['result'] === 1) {
657 657
             $suspendList = $result['data']['account'];
658 658
 
659 659
             $lists = [];
Please login to merge, or discard this patch.