Passed
Push — master ( 6498f8...9717d5 )
by Darko
09:46
created
app/Console/Commands/NntmuxOffsetWorker.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             $engine = $this->getSelectedEngine();
55 55
             $index = $this->getSelectedIndex();
56 56
 
57
-            if (! $engine || ! $index) {
57
+            if (!$engine || !$index) {
58 58
                 $this->error('Engine and index must be specified');
59 59
 
60 60
                 return Command::FAILURE;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             $manticore = new ManticoreSearch;
96 96
             $batchData = [];
97 97
 
98
-            $query->chunk($batchSize, function ($items) use ($manticore, $indexName, $transformer, &$processed, &$errors, &$batchData, $batchSize, $workerId) {
98
+            $query->chunk($batchSize, function($items) use ($manticore, $indexName, $transformer, &$processed, &$errors, &$batchData, $batchSize, $workerId) {
99 99
                 $this->info("Worker {$workerId}: Processing chunk of {$items->count()} items");
100 100
 
101 101
                 foreach ($items as $item) {
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
             });
117 117
 
118 118
             // Process remaining items
119
-            if (! empty($batchData)) {
119
+            if (!empty($batchData)) {
120 120
                 $this->processManticoreBatch($manticore, $indexName, $batchData, $workerId);
121 121
                 $this->info("Worker {$workerId}: Inserted final batch of ".count($batchData).' records');
122 122
             }
123 123
 
124 124
         } else { // ElasticSearch
125
-            $query->chunk($batchSize, function ($items) use ($indexName, $transformer, &$processed, &$errors, $workerId) {
125
+            $query->chunk($batchSize, function($items) use ($indexName, $transformer, &$processed, &$errors, $workerId) {
126 126
                 $this->info("Worker {$workerId}: Processing chunk of {$items->count()} items");
127 127
                 $data = ['body' => []];
128 128
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                     }
146 146
                 }
147 147
 
148
-                if (! empty($data['body'])) {
148
+                if (!empty($data['body'])) {
149 149
                     $this->processElasticBatch($data, $workerId);
150 150
                     $this->info("Worker {$workerId}: Inserted batch of ".(count($data['body']) / 2).' records');
151 151
                 }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     {
194 194
         if ($index === 'releases') {
195 195
             if ($engine === 'manticore') {
196
-                return function ($item) {
196
+                return function($item) {
197 197
                     return [
198 198
                         'id' => (string) $item->id,
199 199
                         'name' => (string) ($item->name ?: ''),
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
                     ];
206 206
                 };
207 207
             } else {
208
-                return function ($item) {
208
+                return function($item) {
209 209
                     $searchName = str_replace(['.', '-'], ' ', $item->searchname ?? '');
210 210
 
211 211
                     return [
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                 };
222 222
             }
223 223
         } else { // predb
224
-            return function ($item) {
224
+            return function($item) {
225 225
                 return [
226 226
                     'id' => $item->id,
227 227
                     'title' => (string) ($item->title ?? ''),
Please login to merge, or discard this patch.
app/Console/Commands/NntmuxOffsetPopulate.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         $engine = $this->getSelectedEngine();
47 47
         $index = $this->getSelectedIndex();
48 48
 
49
-        if (! $engine || ! $index) {
49
+        if (!$engine || !$index) {
50 50
             $this->error('You must specify both an engine (--manticore or --elastic) and an index (--releases or --predb).');
51 51
 
52 52
             return Command::FAILURE;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     private function populateIndexParallel(string $engine, string $index): int
72 72
     {
73 73
         $total = $this->getTotalRecords($index);
74
-        if (! $total) {
74
+        if (!$total) {
75 75
             $this->warn("{$index} table is empty. Nothing to do.");
76 76
 
77 77
             return Command::SUCCESS;
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                     continue;
197 197
                 }
198 198
 
199
-                if (! $process->running()) {
199
+                if (!$process->running()) {
200 200
                     $completedProcesses[] = $processId;
201 201
                     $completed++;
202 202
                     $bar->advance();
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         $bar->finish();
235 235
         $this->newLine();
236 236
 
237
-        if (! empty($failedProcesses)) {
237
+        if (!empty($failedProcesses)) {
238 238
             $this->error('Failed workers: '.implode(', ', $failedProcesses));
239 239
         }
240 240
     }
Please login to merge, or discard this patch.
app/Console/Commands/NntmuxCheckIndex.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $engine = $this->getSelectedEngine();
34 34
         $index = $this->getSelectedIndex();
35 35
 
36
-        if (! $engine || ! $index) {
36
+        if (!$engine || !$index) {
37 37
             $this->error('You must specify both an engine (--manticore or --elastic) and an index (--releases or --predb).');
38 38
 
39 39
             return Command::FAILURE;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             // Check if index exists
66 66
             $exists = \Elasticsearch::indices()->exists(['index' => $index]);
67 67
 
68
-            if (! $exists) {
68
+            if (!$exists) {
69 69
                 $this->error("ElasticSearch index '{$index}' does not exist.");
70 70
 
71 71
                 return;
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
                         $this->info("\nTable structure:");
215 215
                         $this->table(
216 216
                             ['Field', 'Type', 'Properties'],
217
-                            array_map(function ($row) {
217
+                            array_map(function($row) {
218 218
                                 return [
219 219
                                     $row['Field'] ?? $row[0] ?? '',
220 220
                                     $row['Type'] ?? $row[1] ?? '',
Please login to merge, or discard this patch.
app/Services/InvitationService.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     ): Invitation {
23 23
         // Get the user sending the invitation
24 24
         $user = User::find($invitedBy);
25
-        if (! $user) {
25
+        if (!$user) {
26 26
             throw new \Exception('User not found.');
27 27
         }
28 28
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $invitation = Invitation::findOrFail($invitationId);
83 83
 
84
-        if (! $invitation->isValid()) {
84
+        if (!$invitation->isValid()) {
85 85
             throw new \Exception('Cannot resend an invalid invitation.');
86 86
         }
87 87
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $invitation = Invitation::findValidByToken($token);
115 115
 
116
-        if (! $invitation) {
116
+        if (!$invitation) {
117 117
             throw new \Exception('Invalid or expired invitation token.');
118 118
         }
119 119
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     {
198 198
         $invitation = Invitation::findByToken($token);
199 199
 
200
-        if (! $invitation) {
200
+        if (!$invitation) {
201 201
             return null;
202 202
         }
203 203
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     public function getUserInvitationDetails(int $userId): array
219 219
     {
220 220
         $user = User::find($userId);
221
-        if (! $user) {
221
+        if (!$user) {
222 222
             return [];
223 223
         }
224 224
 
Please login to merge, or discard this patch.
app/Models/Invitation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@
 block discarded – undo
154 154
      */
155 155
     public function isUsed(): bool
156 156
     {
157
-        return ! is_null($this->used_at);
157
+        return !is_null($this->used_at);
158 158
     }
159 159
 
160 160
     /**
Please login to merge, or discard this patch.
app/Models/User.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
     {
251 251
         $res = self::query()->where('email', '<>', '[email protected]');
252 252
 
253
-        if (! empty($role)) {
253
+        if (!empty($role)) {
254 254
             $res->where('roles_id', $role);
255 255
         }
256 256
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
             'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60,
292 292
         ];
293 293
 
294
-        if (! empty($email)) {
294
+        if (!empty($email)) {
295 295
             $email = trim($email);
296 296
             $sql += ['email' => $email];
297 297
         }
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
     {
341 341
         $user = self::find($uid);
342 342
         $currRoleExp = $user->rolechangedate ?? now()->toDateTimeString();
343
-        if (! empty($date)) {
343
+        if (!empty($date)) {
344 344
             $user->update(['rolechangedate' => $date]);
345 345
         }
346
-        if (empty($date) && ! empty($addYear)) {
346
+        if (empty($date) && !empty($addYear)) {
347 347
             $user->update(['rolechangedate' => Carbon::createFromDate($currRoleExp)->addYears($addYear)]);
348 348
         }
349 349
     }
@@ -400,10 +400,10 @@  discard block
 block discarded – undo
400 400
         return self::fromQuery(
401 401
             sprintf(
402 402
                 $query,
403
-                ! empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '',
404
-                ! empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '',
405
-                ! empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '',
406
-                (! empty($role) ? ('AND users.roles_id = '.$role) : ''),
403
+                !empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '',
404
+                !empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '',
405
+                !empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '',
406
+                (!empty($role) ? ('AND users.roles_id = '.$role) : ''),
407 407
                 $order[0],
408 408
                 $order[1],
409 409
                 ($start === false ? '' : ('LIMIT '.$offset.' OFFSET '.$start))
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 
516 516
     public static function isValidUrl($url): bool
517 517
     {
518
-        return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true;
518
+        return (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true;
519 519
     }
520 520
 
521 521
     /**
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 
552 552
         // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up.
553 553
         $invitedBy = 0;
554
-        if (! $forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) {
554
+        if (!$forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) {
555 555
             if ($inviteCode === '') {
556 556
                 return self::ERR_SIGNUP_BADINVITECODE;
557 557
             }
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
     public static function checkAndUseInvite(string $inviteCode): int
572 572
     {
573 573
         $invite = Invitation::findValidByToken($inviteCode);
574
-        if (! $invite) {
574
+        if (!$invite) {
575 575
             return -1;
576 576
         }
577 577
 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
     public static function add(string $userName, string $password, string $email, int $role, ?string $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0)
588 588
     {
589 589
         $password = self::hashPassword($password);
590
-        if (! $password) {
590
+        if (!$password) {
591 591
             return false;
592 592
         }
593 593
 
@@ -629,9 +629,9 @@  discard block
 block discarded – undo
629 629
 
630 630
         $cats = ['view console', 'view movies', 'view audio', 'view tv', 'view pc', 'view adult', 'view books', 'view other'];
631 631
 
632
-        if (! empty($allowed)) {
632
+        if (!empty($allowed)) {
633 633
             foreach ($cats as $cat) {
634
-                if (! \in_array($cat, $allowed, false)) {
634
+                if (!\in_array($cat, $allowed, false)) {
635 635
                     $ret[] = match ($cat) {
636 636
                         'view console' => 1000,
637 637
                         'view movies' => 2000,
Please login to merge, or discard this patch.
app/Services/BlacklistService.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function isBlackListed(array $msg, string $groupName): bool
28 28
     {
29
-        if (! isset($this->listsFound[$groupName])) {
29
+        if (!isset($this->listsFound[$groupName])) {
30 30
             $this->retrieveLists($groupName);
31 31
         }
32
-        if (! $this->listsFound[$groupName]) {
32
+        if (!$this->listsFound[$groupName]) {
33 33
             return false;
34 34
         }
35 35
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             }
53 53
         }
54 54
 
55
-        if (! $blackListed && $this->blackList[$groupName]) {
55
+        if (!$blackListed && $this->blackList[$groupName]) {
56 56
             foreach ($this->blackList[$groupName] as $blackList) {
57 57
                 if (@preg_match('/'.$blackList->regex.'/i', $field[$blackList->msgcol])) {
58 58
                     $blackListed = true;
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 
156 156
     private function retrieveLists(string $groupName): void
157 157
     {
158
-        if (! isset($this->blackList[$groupName])) {
158
+        if (!isset($this->blackList[$groupName])) {
159 159
             $this->blackList[$groupName] = $this->getBlacklist(true, \Blacklight\Binaries::OPTYPE_BLACKLIST, $groupName, true);
160 160
         }
161
-        if (! isset($this->whiteList[$groupName])) {
161
+        if (!isset($this->whiteList[$groupName])) {
162 162
             $this->whiteList[$groupName] = $this->getBlacklist(true, \Blacklight\Binaries::OPTYPE_WHITELIST, $groupName, true);
163 163
         }
164 164
         $this->listsFound[$groupName] = ($this->blackList[$groupName] || $this->whiteList[$groupName]);
Please login to merge, or discard this patch.
app/Services/ReleaseCreationService.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $collectionsQuery = Collection::query()
44 44
             ->where('collections.filecheck', ProcessReleases::COLLFC_SIZED)
45 45
             ->where('collections.filesize', '>', 0);
46
-        if (! empty($groupID)) {
46
+        if (!empty($groupID)) {
47 47
             $collectionsQuery->where('collections.groups_id', $groupID);
48 48
         }
49 49
         $collectionsQuery->select(['collections.*', 'usenet_groups.name as gname'])
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
                 $determinedCategory = $categorize->determineCategory($collection->groups_id, $cleanedName);
100 100
 
101
-                $searchName = ! empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName;
101
+                $searchName = !empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName;
102 102
 
103 103
                 $releaseID = Release::insertRelease([
104 104
                     'name' => $cleanRelName,
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                 ]);
118 118
 
119 119
                 if ($releaseID !== null) {
120
-                    DB::transaction(static function () use ($collection, $releaseID) {
120
+                    DB::transaction(static function() use ($collection, $releaseID) {
121 121
                         Collection::query()->where('id', $collection->id)->update([
122 122
                             'filecheck' => ProcessReleases::COLLFC_INSERTED,
123 123
                             'releases_id' => $releaseID,
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
                     }
171 171
                 }
172 172
             } else {
173
-                DB::transaction(static function () use ($collection) {
173
+                DB::transaction(static function() use ($collection) {
174 174
                     Collection::query()->where('collectionhash', $collection->collectionhash)->delete();
175 175
                 }, 10);
176 176
 
Please login to merge, or discard this patch.
app/Services/Par2Processor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -274,7 +274,7 @@
 block discarded – undo
274 274
 
275 275
             // Loop through the files.
276 276
             foreach ($files as $file) {
277
-                if (! isset($file['name'])) {
277
+                if (!isset($file['name'])) {
278 278
                     continue;
279 279
                 }
280 280
 
Please login to merge, or discard this patch.