Passed
Push — master ( c82cf0...d76bbf )
by Darko
10:26
created
app/Models/User.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $res = self::query()->withTrashed()->where('email', '<>', '[email protected]');
260 260
 
261
-        if (! empty($role)) {
261
+        if (!empty($role)) {
262 262
             $res->where('roles_id', $role);
263 263
         }
264 264
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
             'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60,
308 308
         ];
309 309
 
310
-        if (! empty($email)) {
310
+        if (!empty($email)) {
311 311
             $email = trim($email);
312 312
             $sql += ['email' => $email];
313 313
         }
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
     {
357 357
         $user = self::find($uid);
358 358
         $currRoleExp = $user->rolechangedate ?? now()->toDateTimeString();
359
-        if (! empty($date)) {
359
+        if (!empty($date)) {
360 360
             $user->update(['rolechangedate' => $date]);
361 361
         }
362
-        if (empty($date) && ! empty($addYear)) {
362
+        if (empty($date) && !empty($addYear)) {
363 363
             $user->update(['rolechangedate' => Carbon::createFromDate($currRoleExp)->addYears($addYear)]);
364 364
         }
365 365
     }
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
         return self::fromQuery(
417 417
             sprintf(
418 418
                 $query,
419
-                ! empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '',
420
-                ! empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '',
421
-                ! empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '',
422
-                (! empty($role) ? ('AND users.roles_id = '.$role) : ''),
423
-                ! empty($createdFrom) ? 'AND users.created_at >= '.escapeString($createdFrom.' 00:00:00') : '',
424
-                ! empty($createdTo) ? 'AND users.created_at <= '.escapeString($createdTo.' 23:59:59') : '',
419
+                !empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '',
420
+                !empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '',
421
+                !empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '',
422
+                (!empty($role) ? ('AND users.roles_id = '.$role) : ''),
423
+                !empty($createdFrom) ? 'AND users.created_at >= '.escapeString($createdFrom.' 00:00:00') : '',
424
+                !empty($createdTo) ? 'AND users.created_at <= '.escapeString($createdTo.' 23:59:59') : '',
425 425
                 $order[0],
426 426
                 $order[1],
427 427
                 ($start === false ? '' : ('LIMIT '.$offset.' OFFSET '.$start))
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 
534 534
     public static function isValidUrl($url): bool
535 535
     {
536
-        return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true;
536
+        return (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true;
537 537
     }
538 538
 
539 539
     /**
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 
570 570
         // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up.
571 571
         $invitedBy = 0;
572
-        if (! $forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) {
572
+        if (!$forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) {
573 573
             if ($inviteCode === '') {
574 574
                 return self::ERR_SIGNUP_BADINVITECODE;
575 575
             }
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
     public static function checkAndUseInvite(string $inviteCode): int
590 590
     {
591 591
         $invite = Invitation::findValidByToken($inviteCode);
592
-        if (! $invite) {
592
+        if (!$invite) {
593 593
             return -1;
594 594
         }
595 595
 
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
     public static function add(string $userName, string $password, string $email, int $role, ?string $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0)
606 606
     {
607 607
         $password = self::hashPassword($password);
608
-        if (! $password) {
608
+        if (!$password) {
609 609
             return false;
610 610
         }
611 611
 
@@ -647,9 +647,9 @@  discard block
 block discarded – undo
647 647
 
648 648
         $cats = ['view console', 'view movies', 'view audio', 'view tv', 'view pc', 'view adult', 'view books', 'view other'];
649 649
 
650
-        if (! empty($allowed)) {
650
+        if (!empty($allowed)) {
651 651
             foreach ($cats as $cat) {
652
-                if (! \in_array($cat, $allowed, false)) {
652
+                if (!\in_array($cat, $allowed, false)) {
653 653
                     $ret[] = match ($cat) {
654 654
                         'view console' => 1000,
655 655
                         'view movies' => 2000,
Please login to merge, or discard this patch.