Passed
Push — master ( ed202f...f50875 )
by Darko
10:55
created
app/Services/ReleaseProcessingService.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     {
110 110
         if (!$this->settings->hasValidCompletion()) {
111 111
             cli()->error(
112
-                PHP_EOL . 'Invalid completion setting. Value must be between 0 and 100.'
112
+                PHP_EOL.'Invalid completion setting. Value must be between 0 and 100.'
113 113
             );
114 114
         }
115 115
     }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
     {
267 267
         if ($where !== '') {
268 268
             DB::update(
269
-                'UPDATE releases SET categories_id = ?, iscategorized = 0 ' . $where,
269
+                'UPDATE releases SET categories_id = ?, iscategorized = 0 '.$where,
270 270
                 [Category::OTHER_MISC]
271 271
             );
272 272
         } else {
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
         $this->outputSubHeader('Categorizing Releases');
305 305
 
306
-        $query->chunkById(self::CATEGORIZE_CHUNK_SIZE, function ($releases) use ($categorizer, $type, &$categorized, $total): bool {
306
+        $query->chunkById(self::CATEGORIZE_CHUNK_SIZE, function($releases) use ($categorizer, $type, &$categorized, $total): bool {
307 307
             foreach ($releases as $release) {
308 308
                 $categoryResult = $categorizer->determineCategory(
309 309
                     $release->groups_id,
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
         $this->outputSubHeader('Calculating Collection Sizes');
366 366
 
367 367
         $updated = 0;
368
-        DB::transaction(function () use ($groupID, &$updated): void {
368
+        DB::transaction(function() use ($groupID, &$updated): void {
369 369
             $normalizedGroupId = $this->normalizeGroupId($groupID);
370 370
             $whereSql = $normalizedGroupId !== null
371 371
                 ? " AND c.groups_id = {$normalizedGroupId} "
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
                 continue;
420 420
             }
421 421
 
422
-            DB::transaction(function () use ($groupMinSize, $groupMinFiles, &$stats): void {
422
+            DB::transaction(function() use ($groupMinSize, $groupMinFiles, &$stats): void {
423 423
                 $effectiveMinSize = max($groupMinSize, $this->settings->minSizeToFormRelease);
424 424
                 if ($effectiveMinSize > 0) {
425 425
                     $stats['minSize'] += Collection::query()
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
         $total = $query->count();
490 490
 
491 491
         if ($total > 0) {
492
-            $query->chunkById(self::NZB_CHUNK_SIZE, function ($releases) use (&$nzbCount, $total): bool {
492
+            $query->chunkById(self::NZB_CHUNK_SIZE, function($releases) use (&$nzbCount, $total): bool {
493 493
                 foreach ($releases as $release) {
494 494
                     if ($this->nzb->writeNzbForReleaseId($release)) {
495 495
                         $nzbCount++;
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
      */
685 685
     private function runCollectionFileCheckStage1(int $groupID): void
686 686
     {
687
-        DB::transaction(static function () use ($groupID): void {
687
+        DB::transaction(static function() use ($groupID): void {
688 688
             $collectionsQuery = Collection::query()
689 689
                 ->select(['collections.id'])
690 690
                 ->join('binaries', 'binaries.collections_id', '=', 'collections.id')
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
      */
709 709
     private function runCollectionFileCheckStage2(int $groupID): void
710 710
     {
711
-        DB::transaction(static function () use ($groupID): void {
711
+        DB::transaction(static function() use ($groupID): void {
712 712
             $collectionsQuery = Collection::query()
713 713
                 ->select(['collections.id'])
714 714
                 ->join('binaries', 'binaries.collections_id', '=', 'collections.id')
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
                 ->update(['collections.filecheck' => CollectionFileCheckStatus::ZeroPart->value]);
727 727
         }, 10);
728 728
 
729
-        DB::transaction(static function () use ($groupID): void {
729
+        DB::transaction(static function() use ($groupID): void {
730 730
             $query = Collection::query()
731 731
                 ->where('filecheck', '=', CollectionFileCheckStatus::CompleteCollection->value);
732 732
 
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
      */
744 744
     private function runCollectionFileCheckStage3(string $whereSql): void
745 745
     {
746
-        DB::transaction(static function () use ($whereSql): void {
746
+        DB::transaction(static function() use ($whereSql): void {
747 747
             $sql = <<<SQL
748 748
                 UPDATE binaries b
749 749
                 INNER JOIN (
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
             ]);
766 766
         }, 10);
767 767
 
768
-        DB::transaction(static function () use ($whereSql): void {
768
+        DB::transaction(static function() use ($whereSql): void {
769 769
             $sql = <<<SQL
770 770
                 UPDATE binaries b
771 771
                 INNER JOIN (
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
      */
794 794
     private function runCollectionFileCheckStage4(string $whereSql): void
795 795
     {
796
-        DB::transaction(static function () use ($whereSql): void {
796
+        DB::transaction(static function() use ($whereSql): void {
797 797
             $sql = <<<SQL
798 798
                 UPDATE collections c
799 799
                 INNER JOIN (
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
      */
822 822
     private function runCollectionFileCheckStage5(int $groupId): void
823 823
     {
824
-        DB::transaction(static function () use ($groupId): void {
824
+        DB::transaction(static function() use ($groupId): void {
825 825
             $query = Collection::query()
826 826
                 ->whereIn('filecheck', [
827 827
                     CollectionFileCheckStatus::TempComplete->value,
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
      */
842 842
     private function runCollectionFileCheckStage6(string $whereSql): void
843 843
     {
844
-        DB::transaction(function () use ($whereSql): void {
844
+        DB::transaction(function() use ($whereSql): void {
845 845
             $sql = <<<SQL
846 846
                 UPDATE collections c
847 847
                 SET filecheck = ?, totalfiles = (SELECT COUNT(b.id) FROM binaries b WHERE b.collections_id = c.id)
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
                 if ($attempt >= self::MAX_RETRIES) {
926 926
                     if ($this->echoCLI) {
927 927
                         cli()->error(
928
-                            'Stuck collections delete failed after retries: ' . $e->getMessage()
928
+                            'Stuck collections delete failed after retries: '.$e->getMessage()
929 929
                         );
930 930
                     }
931 931
                     break;
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
             ->where('releases.groups_id', $groupId)
948 948
             ->join('usenet_groups', 'usenet_groups.id', '=', 'releases.groups_id')
949 949
             ->whereRaw(
950
-                'GREATEST(IFNULL(usenet_groups.minsizetoformrelease, 0), ?) > 0 ' .
950
+                'GREATEST(IFNULL(usenet_groups.minsizetoformrelease, 0), ?) > 0 '.
951 951
                 'AND releases.size < GREATEST(IFNULL(usenet_groups.minsizetoformrelease, 0), ?)',
952 952
                 [$this->settings->minSizeToFormRelease, $this->settings->minSizeToFormRelease]
953 953
             )
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
             ->where('releases.groups_id', $groupId)
989 989
             ->join('usenet_groups', 'usenet_groups.id', '=', 'releases.groups_id')
990 990
             ->whereRaw(
991
-                'GREATEST(IFNULL(usenet_groups.minfilestoformrelease, 0), ?) > 0 ' .
991
+                'GREATEST(IFNULL(usenet_groups.minfilestoformrelease, 0), ?) > 0 '.
992 992
                 'AND releases.totalpart < GREATEST(IFNULL(usenet_groups.minfilestoformrelease, 0), ?)',
993 993
                 [$this->settings->minFilesToFormRelease, $this->settings->minFilesToFormRelease]
994 994
             )
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
         Release::query()
1013 1013
             ->where('postdate', '<', $cutoff)
1014 1014
             ->select(['id', 'guid'])
1015
-            ->chunkById(self::BATCH_SIZE, function ($releases) use (&$stats): bool {
1015
+            ->chunkById(self::BATCH_SIZE, function($releases) use (&$stats): bool {
1016 1016
                 foreach ($releases as $release) {
1017 1017
                     $this->deleteSingleRelease($release);
1018 1018
                     $stats = $stats->increment('retention');
@@ -1032,12 +1032,12 @@  discard block
 block discarded – undo
1032 1032
         Release::query()
1033 1033
             ->select(['id', 'guid'])
1034 1034
             ->where('passwordstatus', '=', Releases::PASSWD_RAR)
1035
-            ->orWhereIn('id', function ($query): void {
1035
+            ->orWhereIn('id', function($query): void {
1036 1036
                 $query->select('releases_id')
1037 1037
                     ->from('release_files')
1038 1038
                     ->where('passworded', '=', Releases::PASSWD_RAR);
1039 1039
             })
1040
-            ->chunkById(self::BATCH_SIZE, function ($releases) use (&$stats): bool {
1040
+            ->chunkById(self::BATCH_SIZE, function($releases) use (&$stats): bool {
1041 1041
                 foreach ($releases as $release) {
1042 1042
                     $this->deleteSingleRelease($release);
1043 1043
                     $stats = $stats->increment('password');
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
             ->where('completion', '<', $this->settings->completion)
1080 1080
             ->where('completion', '>', 0)
1081 1081
             ->select(['id', 'guid'])
1082
-            ->chunkById(self::BATCH_SIZE, function ($releases) use (&$stats): bool {
1082
+            ->chunkById(self::BATCH_SIZE, function($releases) use (&$stats): bool {
1083 1083
                 foreach ($releases as $release) {
1084 1084
                     $this->deleteSingleRelease($release);
1085 1085
                     $stats = $stats->increment('completion');
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
         Release::query()
1104 1104
             ->whereIn('categories_id', $categoryIds)
1105 1105
             ->select(['id', 'guid'])
1106
-            ->chunkById(self::BATCH_SIZE, function ($releases) use (&$stats): bool {
1106
+            ->chunkById(self::BATCH_SIZE, function($releases) use (&$stats): bool {
1107 1107
                 foreach ($releases as $release) {
1108 1108
                     $this->deleteSingleRelease($release);
1109 1109
                     $stats = $stats->increment('disabledCategory');
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
                 ->where('size', '<', (int) $category->minsize)
1128 1128
                 ->select(['id', 'guid'])
1129 1129
                 ->limit(1000)
1130
-                ->chunkById(self::BATCH_SIZE, function ($releases) use (&$stats): bool {
1130
+                ->chunkById(self::BATCH_SIZE, function($releases) use (&$stats): bool {
1131 1131
                     foreach ($releases as $release) {
1132 1132
                         $this->deleteSingleRelease($release);
1133 1133
                         $stats = $stats->increment('categoryMinSize');
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
                     static fn($join) => $join->on('releases.musicinfo_id', '=', 'mi.id')
1161 1161
                 )
1162 1162
                 ->select(['releases.id', 'releases.guid'])
1163
-                ->chunkById(self::BATCH_SIZE, function ($releases) use (&$stats): bool {
1163
+                ->chunkById(self::BATCH_SIZE, function($releases) use (&$stats): bool {
1164 1164
                     foreach ($releases as $release) {
1165 1165
                         $this->deleteSingleRelease($release);
1166 1166
                         $stats = $stats->increment('disabledGenre');
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
                 ->where('categories_id', Category::OTHER_MISC)
1182 1182
                 ->where('adddate', '<=', $cutoff)
1183 1183
                 ->select(['id', 'guid'])
1184
-                ->chunkById(self::BATCH_SIZE, function ($releases) use (&$stats): bool {
1184
+                ->chunkById(self::BATCH_SIZE, function($releases) use (&$stats): bool {
1185 1185
                     foreach ($releases as $release) {
1186 1186
                         $this->deleteSingleRelease($release);
1187 1187
                         $stats = $stats->increment('miscOther');
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
                 ->where('categories_id', Category::OTHER_HASHED)
1198 1198
                 ->where('adddate', '<=', $cutoff)
1199 1199
                 ->select(['id', 'guid'])
1200
-                ->chunkById(self::BATCH_SIZE, function ($releases) use (&$stats): bool {
1200
+                ->chunkById(self::BATCH_SIZE, function($releases) use (&$stats): bool {
1201 1201
                     foreach ($releases as $release) {
1202 1202
                         $this->deleteSingleRelease($release);
1203 1203
                         $stats = $stats->increment('miscHashed');
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 
1231 1231
         echo PHP_EOL;
1232 1232
         cli()->header('NNTmux Release Processing');
1233
-        cli()->info('Started: ' . now()->format('Y-m-d H:i:s'));
1233
+        cli()->info('Started: '.now()->format('Y-m-d H:i:s'));
1234 1234
     }
1235 1235
 
1236 1236
     private function outputHeader(string $title): void
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
         }
1323 1323
 
1324 1324
         $percent = min(100, (int) (($current / $total) * 100));
1325
-        echo "\r      {$action}: " . number_format($current) . '/' . number_format($total) . " ({$percent}%)   ";
1325
+        echo "\r      {$action}: ".number_format($current).'/'.number_format($total)." ({$percent}%)   ";
1326 1326
 
1327 1327
         if ($current >= $total) {
1328 1328
             echo PHP_EOL;
@@ -1345,13 +1345,13 @@  discard block
 block discarded – undo
1345 1345
         echo PHP_EOL;
1346 1346
         cli()->header('SUMMARY');
1347 1347
         cli()->header('-------');
1348
-        cli()->primary('  Releases added: ' . number_format($releasesAdded));
1349
-        cli()->primary('  NZBs created: ' . number_format($nzbsCreated));
1348
+        cli()->primary('  Releases added: '.number_format($releasesAdded));
1349
+        cli()->primary('  NZBs created: '.number_format($nzbsCreated));
1350 1350
         if ($dupes > 0) {
1351
-            cli()->warning('  Duplicates skipped: ' . number_format($dupes));
1351
+            cli()->warning('  Duplicates skipped: '.number_format($dupes));
1352 1352
         }
1353
-        cli()->info('  Processing cycles: ' . number_format($iterations));
1354
-        cli()->info('  Total time: ' . $this->formatElapsedTime($elapsed));
1353
+        cli()->info('  Processing cycles: '.number_format($iterations));
1354
+        cli()->info('  Total time: '.$this->formatElapsedTime($elapsed));
1355 1355
         echo PHP_EOL;
1356 1356
     }
1357 1357
 
Please login to merge, or discard this patch.
app/Services/Tmux/Scripts/groupfixrelnames.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 require_once __DIR__.'/../../../../bootstrap/autoload.php';
14 14
 
15
-if (! isset($argv[1])) {
15
+if (!isset($argv[1])) {
16 16
     cli()->error('This script is not intended to be run manually, it is called from Multiprocessing.');
17 17
     exit(1);
18 18
 }
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 switch ($type) {
27 27
     case 'standard':
28
-        if ($guidChar === null || $maxPerRun === null || ! is_numeric($maxPerRun)) {
28
+        if ($guidChar === null || $maxPerRun === null || !is_numeric($maxPerRun)) {
29 29
             cli()->error('Invalid arguments for standard type');
30 30
             exit(1);
31 31
         }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         break;
35 35
 
36 36
     case 'predbft':
37
-        if (! isset($maxPerRun) || ! is_numeric($maxPerRun) || ! isset($thread) || ! is_numeric($thread)) {
37
+        if (!isset($maxPerRun) || !is_numeric($maxPerRun) || !isset($thread) || !is_numeric($thread)) {
38 38
             cli()->error('Invalid arguments for predbft type');
39 39
             exit(1);
40 40
         }
Please login to merge, or discard this patch.
app/Services/BookService.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 			%s
160 160
 			GROUP BY boo.id
161 161
 			ORDER BY %s %s',
162
-            \is_array($bookIDs) && ! empty($bookIDs) ? implode(',', $bookIDs) : -1,
163
-            \is_array($releaseIDs) && ! empty($releaseIDs) ? implode(',', $releaseIDs) : -1,
162
+            \is_array($bookIDs) && !empty($bookIDs) ? implode(',', $bookIDs) : -1,
163
+            \is_array($releaseIDs) && !empty($releaseIDs) ? implode(',', $releaseIDs) : -1,
164 164
             $catsrch,
165 165
             $order[0],
166 166
             $order[1]
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     {
238 238
         $browseby = ' ';
239 239
         foreach ($this->getBrowseByOptions() as $bbk => $bbv) {
240
-            if (! empty($_REQUEST[$bbk])) {
240
+            if (!empty($_REQUEST[$bbk])) {
241 241
                 $bbs = stripslashes($_REQUEST[$bbk]);
242 242
                 $browseby .= ' AND boo.'.$bbv.' '.'LIKE '.escapeString('%'.$bbs.'%');
243 243
             }
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
                 return false;
405 405
             }
406 406
 
407
-            if (preg_match('/^([a-z0-9ü!]+ ){1,2}(N|Vol)?\d{1,4}([abc])?$|^([a-z0-9]+ ){1,2}(Jan( |unar|$)|Feb( |ruary|$)|Mar( |ch|$)|Apr( |il|$)|May(?![a-z0-9])|Jun([ e$])|Jul([ y$])|Aug( |ust|$)|Sep( |tember|$)|O([ck])t( |ober|$)|Nov( |ember|$)|De([cz])( |ember|$))/ui', $releasename) && ! preg_match('/Part \d+/i', $releasename)) {
407
+            if (preg_match('/^([a-z0-9ü!]+ ){1,2}(N|Vol)?\d{1,4}([abc])?$|^([a-z0-9]+ ){1,2}(Jan( |unar|$)|Feb( |ruary|$)|Mar( |ch|$)|Apr( |il|$)|May(?![a-z0-9])|Jun([ e$])|Jul([ y$])|Aug( |ust|$)|Sep( |tember|$)|O([ck])t( |ober|$)|Nov( |ember|$)|De([cz])( |ember|$))/ui', $releasename) && !preg_match('/Part \d+/i', $releasename)) {
408 408
                 if ($this->echooutput) {
409 409
                     cli()->headerOver('Changing category to magazines: ').cli()->primary($releasename);
410 410
                 }
@@ -412,14 +412,14 @@  discard block
 block discarded – undo
412 412
 
413 413
                 return false;
414 414
             }
415
-            if (! empty($releasename) && ! preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) {
415
+            if (!empty($releasename) && !preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) {
416 416
                 return $releasename;
417 417
             }
418 418
 
419 419
             return false;
420 420
         }
421 421
         if ($releasetype === 'audiobook') {
422
-            if (! empty($releasename) && ! preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) {
422
+            if (!empty($releasename) && !preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) {
423 423
                 // we can skip category for audiobooks, since we already know it, so as long as the release name is valid return it so that it is postprocessed by amazon.  In the future, determining the type of audiobook could be added (Lecture or book), since we can skip lookups on lectures, but for now handle them all the same way
424 424
                 return $releasename;
425 425
             }
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 
446 446
         $book = false;
447 447
         if ($bookInfo !== '') {
448
-            if (! $book) {
448
+            if (!$book) {
449 449
                 cli()->info('Fetching data from iTunes for '.$bookInfo);
450 450
                 $book = $this->fetchItunesBookProperties($bookInfo);
451 451
             } elseif ($amazdata !== null) {
@@ -552,13 +552,13 @@  discard block
 block discarded – undo
552 552
             'salesrank' => '',
553 553
             'publisher' => '',
554 554
             'pages' => '',
555
-            'coverurl' => ! empty($iTunesBook['cover']) ? $iTunesBook['cover'] : '',
555
+            'coverurl' => !empty($iTunesBook['cover']) ? $iTunesBook['cover'] : '',
556 556
             'genre' => is_array($iTunesBook['genres']) ? implode(', ', $iTunesBook['genres']) : $iTunesBook['genre'],
557 557
             'overview' => strip_tags($iTunesBook['description'] ?? ''),
558 558
             'publishdate' => $iTunesBook['release_date'],
559 559
         ];
560 560
 
561
-        if (! empty($book['coverurl'])) {
561
+        if (!empty($book['coverurl'])) {
562 562
             $book['cover'] = 1;
563 563
         } else {
564 564
             $book['cover'] = 0;
Please login to merge, or discard this patch.
app/Services/NNTP/NNTPService.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         ];
207 207
         $primaryConnections = $this->_tmux->getUSPConnections('primary', $primaryUSP);
208 208
         $alternateConnections = $this->_tmux->getUSPConnections('alternate', $alternateUSP);
209
-        if ($this->_isConnected() && (($alternate && $this->_currentServer === $this->_configAlternateServer && ($this->_primaryNntpConnections < $alternateConnections['alternate']['active'])) || (! $alternate && $this->_currentServer === $this->_configServer && ($this->_primaryNntpConnections < $primaryConnections['primary']['active'])))) {
209
+        if ($this->_isConnected() && (($alternate && $this->_currentServer === $this->_configAlternateServer && ($this->_primaryNntpConnections < $alternateConnections['alternate']['active'])) || (!$alternate && $this->_currentServer === $this->_configServer && ($this->_primaryNntpConnections < $primaryConnections['primary']['active'])))) {
210 210
             return true;
211 211
         }
212 212
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $ret = $connected = $cError = $aError = false;
216 216
 
217 217
         // Set variables to connect based on if we are using the alternate provider or not.
218
-        if (! $alternate) {
218
+        if (!$alternate) {
219 219
             $sslEnabled = $this->_configSsl;
220 220
             $this->_currentServer = $this->_configServer;
221 221
             $this->_currentPort = $this->_configPort;
@@ -241,19 +241,19 @@  discard block
 block discarded – undo
241 241
             $authenticated = false;
242 242
 
243 243
             // If we are not connected, try to connect.
244
-            if (! $connected) {
244
+            if (!$connected) {
245 245
                 $ret = $this->connect($this->_currentServer, $sslEnabled, $this->_currentPort, 5, $socketTimeout);
246 246
             }
247 247
             // Check if we got an error while connecting.
248 248
             $cErr = self::isError($ret);
249 249
 
250 250
             // If no error, we are connected.
251
-            if (! $cErr) {
251
+            if (!$cErr) {
252 252
                 // Say that we are connected so we don't retry.
253 253
                 $connected = true;
254 254
                 // When there is no error it returns bool if we are allowed to post or not.
255 255
                 $this->_postingAllowed = $ret;
256
-            } elseif (! $cError) {
256
+            } elseif (!$cError) {
257 257
                 $cError = $ret->getMessage();
258 258
             }
259 259
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             }
264 264
 
265 265
             // If we have no more retries and could not connect, return an error.
266
-            if ($retries === 0 && ! $connected) {
266
+            if ($retries === 0 && !$connected) {
267 267
                 $message =
268 268
                     'Cannot connect to server '.
269 269
                     $this->_currentServer.
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
                     $aErr = self::isError($ret2);
289 289
 
290 290
                     // If there was no error, then we are authenticated.
291
-                    if (! $aErr) {
291
+                    if (!$aErr) {
292 292
                         $authenticated = true;
293
-                    } elseif (! $aError) {
293
+                    } elseif (!$aError) {
294 294
                         $aError = $ret2->getMessage();
295 295
                     }
296 296
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
                     }
301 301
 
302 302
                     // If we ran out of retries, return an error.
303
-                    if ($retries === 0 && ! $authenticated) {
303
+                    if ($retries === 0 && !$authenticated) {
304 304
                         $message =
305 305
                             'Cannot authenticate to server '.
306 306
                             $this->_currentServer.
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             // If we are connected and authenticated, try enabling compression if we have it enabled.
317 317
             if ($connected && $authenticated) {
318 318
                 // Check if we should use compression on the connection.
319
-                if (! $compression || ! $this->_configCompressedHeaders) {
319
+                if (!$compression || !$this->_configCompressedHeaders) {
320 320
                     $this->_compressionSupported = false;
321 321
                 }
322 322
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      */
380 380
     public function enableCompression(): void
381 381
     {
382
-        if (! $this->_configCompressedHeaders) {
382
+        if (!$this->_configCompressedHeaders) {
383 383
             return;
384 384
         }
385 385
         $this->_enableCompression();
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
                 $message = $this->_getMessage($groupName, $wanted);
600 600
 
601 601
                 // Append the body to $body.
602
-                if (! self::isError($message)) {
602
+                if (!self::isError($message)) {
603 603
                     $body .= $message;
604 604
 
605 605
                     if ($messageSize === 0) {
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 
609 609
                     // If there is an error try the alternate provider or return the PEAR error.
610 610
                 } elseif ($alternate) {
611
-                    if (! $aConnected) {
611
+                    if (!$aConnected) {
612 612
                         // Check if the current connected server is the alternate or not.
613 613
                         $aConnected = $this->_currentServer === $this->_configServer
614 614
                             ? $nntp->doConnect($this->_configCompressedHeaders, true)
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
                 return $body;
698 698
             }
699 699
             $msg = $this->_getMessageByMessageID($id);
700
-            if (! self::isError($msg)) {
700
+            if (!self::isError($msg)) {
701 701
                 $body .= $msg;
702 702
                 if ($messageSize === 0) {
703 703
                     $messageSize = strlen($msg);
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
             }
708 708
             // Primary failed, try alternate if requested
709 709
             if ($alternate) {
710
-                if (! $aConnected) {
710
+                if (!$aConnected) {
711 711
                     $aConnected = $this->_currentServer === $this->_configServer
712 712
                         ? $alt->doConnect($this->_configCompressedHeaders, true)
713 713
                         : $alt->doConnect();
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         $bodyParts = [];
766 766
         $socket = $this->_socket;
767 767
 
768
-        while (! feof($socket)) {
768
+        while (!feof($socket)) {
769 769
             $line = fgets($socket, 8192);
770 770
             if ($line === false) {
771 771
                 return $this->throwError('Failed to read line from socket.', null);
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
         if ($this->_compressionEnabled) {
856 856
             return true;
857 857
         }
858
-        if (! $this->_compressionSupported) {
858
+        if (!$this->_compressionSupported) {
859 859
             return false;
860 860
         }
861 861
 
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
             return $response;
870 870
         }
871 871
         if ($response !== 290) {
872
-            if (! $secondTry) {
872
+            if (!$secondTry) {
873 873
                 // Retry.
874 874
                 $this->cmdQuit();
875 875
                 if ($this->_checkConnection()) {
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
         $dataParts = [];
930 930
         $socket = $this->_socket;
931 931
 
932
-        while (! feof($socket)) {
932
+        while (!feof($socket)) {
933 933
             // Did we find a possible ending ? (.\r\n)
934 934
             if ($possibleTerm) {
935 935
                 // Use stream_select for more efficient socket polling
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
                     $data = implode('', $dataParts);
955 955
                     $deComp = @gzuncompress(substr($data, 0, -3));
956 956
 
957
-                    if (! empty($deComp)) {
957
+                    if (!empty($deComp)) {
958 958
                         $bytesReceived = \strlen($data);
959 959
                         if ($this->_echo && $bytesReceived > 10240) {
960 960
                             cli()->primaryOver(
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
         }
1029 1029
 
1030 1030
         // Check if the last char is >, if not add it.
1031
-        if (! str_ends_with($messageID, '>')) {
1031
+        if (!str_ends_with($messageID, '>')) {
1032 1032
             $messageID .= '>';
1033 1033
         }
1034 1034
 
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
         }
1056 1056
 
1057 1057
         // Check if this is an article number or message-id.
1058
-        if (! is_numeric($identifier)) {
1058
+        if (!is_numeric($identifier)) {
1059 1059
             // It's a message-id so check if it has the triangular brackets.
1060 1060
             $identifier = $this->_formatMessageID($identifier);
1061 1061
         }
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
             $socket = $this->_socket;
1073 1073
 
1074 1074
             // Continue until connection is lost
1075
-            while (! feof($socket)) {
1075
+            while (!feof($socket)) {
1076 1076
                 // Retrieve and append up to 8192 characters from the server (larger buffer = fewer syscalls)
1077 1077
                 $line = fgets($socket, 8192);
1078 1078
 
@@ -1325,7 +1325,7 @@  discard block
 block discarded – undo
1325 1325
      */
1326 1326
     public function _isConnected(bool $feOf = true): bool
1327 1327
     {
1328
-        return is_resource($this->_socket) && (! $feOf || ! feof($this->_socket));
1328
+        return is_resource($this->_socket) && (!$feOf || !feof($this->_socket));
1329 1329
     }
1330 1330
 
1331 1331
     /**
Please login to merge, or discard this patch.
app/Services/AdultProcessing/AdultProcessingPipeline.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
             }
199 199
 
200 200
             if ($this->echoOutput) {
201
-                cli()->header('Processing ' . $releaseCount . ' XXX releases using pipeline.');
201
+                cli()->header('Processing '.$releaseCount.' XXX releases using pipeline.');
202 202
             }
203 203
 
204 204
             // Process releases in batches for parallel processing
@@ -207,12 +207,12 @@  discard block
 block discarded – undo
207 207
 
208 208
             foreach ($batches as $batchIndex => $batch) {
209 209
                 if ($this->echoOutput) {
210
-                    cli()->info('Processing batch ' . ($batchIndex + 1) . ' of ' . count($batches));
210
+                    cli()->info('Processing batch '.($batchIndex + 1).' of '.count($batches));
211 211
                 }
212 212
                 $this->processBatch($batch);
213 213
             }
214 214
         } catch (\Throwable $e) {
215
-            Log::error('processXXXReleases failed: ' . $e->getMessage(), [
215
+            Log::error('processXXXReleases failed: '.$e->getMessage(), [
216 216
                 'exception' => get_class($e),
217 217
                 'file' => $e->getFile(),
218 218
                 'line' => $e->getLine(),
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             ]);
221 221
 
222 222
             if ($this->echoOutput) {
223
-                cli()->error('Error during processing: ' . $e->getMessage());
223
+                cli()->error('Error during processing: '.$e->getMessage());
224 224
             }
225 225
         }
226 226
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                 $releaseId = (int) ($release['id'] ?? 0);
252 252
 
253 253
                 if ($releaseId <= 0) {
254
-                    Log::warning('Invalid release ID in batch: ' . json_encode($release));
254
+                    Log::warning('Invalid release ID in batch: '.json_encode($release));
255 255
                     $this->stats['failed']++;
256 256
                     continue;
257 257
                 }
@@ -260,14 +260,14 @@  discard block
 block discarded – undo
260 260
                     $this->processReleaseItem($release);
261 261
                 } catch (\Throwable $e) {
262 262
                     // processReleaseItem should handle its own exceptions, but this is a fallback
263
-                    Log::error('Unexpected error in processBatch for release ' . $releaseId . ': ' . $e->getMessage());
263
+                    Log::error('Unexpected error in processBatch for release '.$releaseId.': '.$e->getMessage());
264 264
                     $this->stats['failed']++;
265 265
 
266 266
                     // Ensure the release is marked as processed to avoid infinite loop
267 267
                     try {
268 268
                         $this->updateReleaseXxxId($releaseId, -2);
269 269
                     } catch (\Throwable $updateError) {
270
-                        Log::error('Failed to update release ' . $releaseId . ' with error code: ' . $updateError->getMessage());
270
+                        Log::error('Failed to update release '.$releaseId.' with error code: '.$updateError->getMessage());
271 271
                     }
272 272
                 }
273 273
             }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
                 $this->stats['processed']++;
309 309
             }
310 310
         } catch (\Throwable $e) {
311
-            Log::error('Async batch processing failed: ' . $e->getMessage());
311
+            Log::error('Async batch processing failed: '.$e->getMessage());
312 312
 
313 313
             // Mark all releases in batch as processed with error to avoid infinite loop
314 314
             foreach ($batch as $release) {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
                 try {
317 317
                     Release::query()->where('id', $release['id'])->update(['xxxinfo_id' => -2]);
318 318
                 } catch (\Throwable $updateError) {
319
-                    Log::error('Failed to mark release ' . $release['id'] . ' as processed: ' . $updateError->getMessage());
319
+                    Log::error('Failed to mark release '.$release['id'].' as processed: '.$updateError->getMessage());
320 320
                 }
321 321
             }
322 322
         }
@@ -409,12 +409,12 @@  discard block
 block discarded – undo
409 409
 
410 410
             if ($existingInfo !== null) {
411 411
                 if ($this->echoOutput) {
412
-                    cli()->info('Local match found for XXX Movie: ' . $cleanTitle);
412
+                    cli()->info('Local match found for XXX Movie: '.$cleanTitle);
413 413
                 }
414 414
                 $idCheck = (int) $existingInfo['id'];
415 415
             } else {
416 416
                 if ($this->echoOutput) {
417
-                    cli()->info('Looking up: ' . $cleanTitle);
417
+                    cli()->info('Looking up: '.$cleanTitle);
418 418
                     cli()->info('Local match not found, checking web!');
419 419
                 }
420 420
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
                 $this->stats['matched']++;
434 434
             }
435 435
         } catch (\Throwable $e) {
436
-            Log::error('Processing failed for release ' . $releaseId . ': ' . $e->getMessage(), [
436
+            Log::error('Processing failed for release '.$releaseId.': '.$e->getMessage(), [
437 437
                 'exception' => get_class($e),
438 438
                 'file' => $e->getFile(),
439 439
                 'line' => $e->getLine(),
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
             try {
445 445
                 $this->updateReleaseXxxId($releaseId, -2);
446 446
             } catch (\Throwable $updateError) {
447
-                Log::error('Failed to update release ' . $releaseId . ' after processing error: ' . $updateError->getMessage());
447
+                Log::error('Failed to update release '.$releaseId.' after processing error: '.$updateError->getMessage());
448 448
             }
449 449
             $this->stats['failed']++;
450 450
         }
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
                 'hotm' => 'HotMovies',
478 478
                 default => $providerName,
479 479
             };
480
-            cli()->primary('Fetching XXX info from: ' . $fromStr);
480
+            cli()->primary('Fetching XXX info from: '.$fromStr);
481 481
         }
482 482
 
483 483
         // Track provider usage
@@ -515,19 +515,19 @@  discard block
 block discarded – undo
515 515
 
516 516
             // Update BoxCover
517 517
             if (!empty($mov['cover'])) {
518
-                $cover = $this->releaseImage->saveImage($xxxID . '-cover', $mov['cover'], $this->imgSavePath);
518
+                $cover = $this->releaseImage->saveImage($xxxID.'-cover', $mov['cover'], $this->imgSavePath);
519 519
             }
520 520
 
521 521
             // BackCover
522 522
             if (!empty($mov['backdrop'])) {
523
-                $backdrop = $this->releaseImage->saveImage($xxxID . '-backdrop', $mov['backdrop'], $this->imgSavePath, 1920, 1024);
523
+                $backdrop = $this->releaseImage->saveImage($xxxID.'-backdrop', $mov['backdrop'], $this->imgSavePath, 1920, 1024);
524 524
             }
525 525
 
526 526
             // Update existing record
527 527
             XxxInfo::query()->where('id', $check['id'])->update([
528 528
                 'title' => $mov['title'],
529 529
                 'tagline' => $mov['tagline'],
530
-                'plot' => "\x1f\x8b\x08\x00" . gzcompress($mov['plot']),
530
+                'plot' => "\x1f\x8b\x08\x00".gzcompress($mov['plot']),
531 531
                 'genre' => substr($mov['genre'], 0, 64),
532 532
                 'director' => $mov['director'],
533 533
                 'actors' => $mov['actors'],
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
             $xxxID = XxxInfo::query()->insertGetId([
545 545
                 'title' => $mov['title'],
546 546
                 'tagline' => $mov['tagline'],
547
-                'plot' => "\x1f\x8b\x08\x00" . gzcompress($mov['plot']),
547
+                'plot' => "\x1f\x8b\x08\x00".gzcompress($mov['plot']),
548 548
                 'genre' => substr($mov['genre'], 0, 64),
549 549
                 'director' => $mov['director'],
550 550
                 'actors' => $mov['actors'],
@@ -559,12 +559,12 @@  discard block
 block discarded – undo
559 559
 
560 560
             // Update BoxCover
561 561
             if (!empty($mov['cover'])) {
562
-                $cover = $this->releaseImage->saveImage($xxxID . '-cover', $mov['cover'], $this->imgSavePath);
562
+                $cover = $this->releaseImage->saveImage($xxxID.'-cover', $mov['cover'], $this->imgSavePath);
563 563
             }
564 564
 
565 565
             // BackCover
566 566
             if (!empty($mov['backdrop'])) {
567
-                $backdrop = $this->releaseImage->saveImage($xxxID . '-backdrop', $mov['backdrop'], $this->imgSavePath, 1920, 1024);
567
+                $backdrop = $this->releaseImage->saveImage($xxxID.'-backdrop', $mov['backdrop'], $this->imgSavePath, 1920, 1024);
568 568
             }
569 569
 
570 570
             XxxInfo::whereId($xxxID)->update(['cover' => $cover, 'backdrop' => $backdrop]);
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
         if ($this->echoOutput) {
574 574
             cli()->primary(
575
-                ($xxxID !== false ? 'Added/updated XXX movie: ' . $mov['title'] : 'Nothing to update for XXX movie: ' . $mov['title']),
575
+                ($xxxID !== false ? 'Added/updated XXX movie: '.$mov['title'] : 'Nothing to update for XXX movie: '.$mov['title']),
576 576
                 true
577 577
             );
578 578
         }
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
      */
619 619
     protected function checkXXXInfoExists(string $releaseName): ?array
620 620
     {
621
-        $result = XxxInfo::query()->where('title', 'like', '%' . $releaseName . '%')->first(['id', 'title']);
621
+        $result = XxxInfo::query()->where('title', 'like', '%'.$releaseName.'%')->first(['id', 'title']);
622 622
         return $result ? $result->toArray() : null;
623 623
     }
624 624
 
@@ -648,9 +648,9 @@  discard block
 block discarded – undo
648 648
         foreach ($arr as $value) {
649 649
             $res = Genre::query()->where('title', $value)->first(['id']);
650 650
             if ($res !== null) {
651
-                $ret .= ',' . $res['id'];
651
+                $ret .= ','.$res['id'];
652 652
             } else {
653
-                $ret .= ',' . $this->insertGenre($value);
653
+                $ret .= ','.$this->insertGenre($value);
654 654
             }
655 655
         }
656 656
 
@@ -682,12 +682,12 @@  discard block
 block discarded – undo
682 682
         $name = '';
683 683
         $followingList = '[^\w]((2160|1080|480|720)(p|i)|AC3D|Directors([^\w]CUT)?|DD5\.1|(DVD|BD|BR)(Rip)?|BluRay|divx|HDTV|iNTERNAL|LiMiTED|(Real\.)?Proper|RE(pack|Rip)|Sub\.?(fix|pack)|Unrated|WEB-DL|(x|H)[ ._-]?264|xvid|[Dd][Ii][Ss][Cc](\d+|\s*\d+|\.\d+)|XXX|BTS|DirFix|Trailer|WEBRiP|NFO|(19|20)\d\d)[^\w]';
684 684
 
685
-        if (preg_match('/([^\w]{2,})?(?P<name>[\w .-]+?)' . $followingList . '/i', $releaseName, $hits)) {
685
+        if (preg_match('/([^\w]{2,})?(?P<name>[\w .-]+?)'.$followingList.'/i', $releaseName, $hits)) {
686 686
             $name = $hits['name'];
687 687
         }
688 688
 
689 689
         if ($name !== '') {
690
-            $name = preg_replace('/' . $followingList . '/i', ' ', $name);
690
+            $name = preg_replace('/'.$followingList.'/i', ' ', $name);
691 691
             $name = preg_replace('/\(.*?\)|[._-]/i', ' ', $name);
692 692
             $name = trim(preg_replace('/\s{2,}/', ' ', $name));
693 693
             $name = trim(preg_replace('/^Private\s(Specials|Blockbusters|Blockbuster|Sports|Gold|Lesbian|Movies|Classics|Castings|Fetish|Stars|Pictures|XXX|Private|Black\sLabel|Black)\s\d+/i', '', $name));
@@ -727,10 +727,10 @@  discard block
 block discarded – undo
727 727
     protected function outputStats(): void
728 728
     {
729 729
         cli()->header("\n=== Adult Processing Statistics ===");
730
-        cli()->primary('Processed: ' . $this->stats['processed']);
731
-        cli()->primary('Matched: ' . $this->stats['matched']);
732
-        cli()->primary('Failed: ' . $this->stats['failed']);
733
-        cli()->primary('Skipped: ' . $this->stats['skipped']);
730
+        cli()->primary('Processed: '.$this->stats['processed']);
731
+        cli()->primary('Matched: '.$this->stats['matched']);
732
+        cli()->primary('Failed: '.$this->stats['failed']);
733
+        cli()->primary('Skipped: '.$this->stats['skipped']);
734 734
         cli()->primary(sprintf('Duration: %.2f seconds', $this->stats['duration']));
735 735
 
736 736
         if (!empty($this->stats['providers'])) {
Please login to merge, or discard this patch.
app/Extensions/helper/helpers.php 1 patch
Spacing   +50 added lines, -51 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use Symfony\Component\Process\Process;
16 16
 use Zip as ZipStream;
17 17
 
18
-if (! function_exists('getRawHtml')) {
18
+if (!function_exists('getRawHtml')) {
19 19
     /**
20 20
      * @param  bool  $cookie
21 21
      * @return bool|mixed|string
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     }
107 107
 }
108 108
 
109
-if (! function_exists('makeFieldLinks')) {
109
+if (!function_exists('makeFieldLinks')) {
110 110
     /**
111 111
      * @return string
112 112
      *
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     }
137 137
 }
138 138
 
139
-if (! function_exists('getUserBrowseOrder')) {
139
+if (!function_exists('getUserBrowseOrder')) {
140 140
     /**
141 141
      * @param  string  $orderBy
142 142
      */
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     }
163 163
 }
164 164
 
165
-if (! function_exists('getUserBrowseOrdering')) {
165
+if (!function_exists('getUserBrowseOrdering')) {
166 166
     function getUserBrowseOrdering(): array
167 167
     {
168 168
         return [
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     }
193 193
 }
194 194
 
195
-if (! function_exists('getSimilarName')) {
195
+if (!function_exists('getSimilarName')) {
196 196
     /**
197 197
      * @param  string  $name
198 198
      */
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     }
203 203
 }
204 204
 
205
-if (! function_exists('human_filesize')) {
205
+if (!function_exists('human_filesize')) {
206 206
     /**
207 207
      * @param  int  $decimals
208 208
      */
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     }
216 216
 }
217 217
 
218
-if (! function_exists('bcdechex')) {
218
+if (!function_exists('bcdechex')) {
219 219
     /**
220 220
      * @return string
221 221
      */
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     }
233 233
 }
234 234
 
235
-if (! function_exists('runCmd')) {
235
+if (!function_exists('runCmd')) {
236 236
     /**
237 237
      * Run CLI command.
238 238
      *
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     }
261 261
 }
262 262
 
263
-if (! function_exists('escapeString')) {
263
+if (!function_exists('escapeString')) {
264 264
 
265 265
     function escapeString($string): string
266 266
     {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     }
269 269
 }
270 270
 
271
-if (! function_exists('realDuration')) {
271
+if (!function_exists('realDuration')) {
272 272
 
273 273
     function realDuration($milliseconds): string
274 274
     {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     }
279 279
 }
280 280
 
281
-if (! function_exists('is_it_json')) {
281
+if (!function_exists('is_it_json')) {
282 282
     /**
283 283
      * @throws JsonException
284 284
      */
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     }
294 294
 }
295 295
 
296
-if (! function_exists('getStreamingZip')) {
296
+if (!function_exists('getStreamingZip')) {
297 297
     /**
298 298
      * @throws Exception
299 299
      */
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     }
321 321
 }
322 322
 
323
-if (! function_exists('release_flag')) {
323
+if (!function_exists('release_flag')) {
324 324
     // Function inspired by c0r3@newznabforums adds country flags on the browse page.
325 325
     /**
326 326
      * @param  string  $text  Text to match against.
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
     }
458 458
 }
459 459
 
460
-if (! function_exists('getReleaseCover')) {
460
+if (!function_exists('getReleaseCover')) {
461 461
     /**
462 462
      * Get the cover image URL for a release based on its type and ID
463 463
      *
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
         $coverId = null;
471 471
 
472 472
         // Helper function to get value from object or array
473
-        $getValue = function ($data, $key) {
473
+        $getValue = function($data, $key) {
474 474
             if (is_array($data)) {
475 475
                 return $data[$key] ?? null;
476 476
             } elseif (is_object($data)) {
@@ -489,25 +489,25 @@  discard block
 block discarded – undo
489 489
         $xxxinfo_id = $getValue($release, 'xxxinfo_id');
490 490
         $anidbid = $getValue($release, 'anidbid');
491 491
 
492
-        if (! empty($imdbid) && $imdbid > 0) {
492
+        if (!empty($imdbid) && $imdbid > 0) {
493 493
             $coverType = 'movies';
494 494
             $coverId = str_pad($imdbid, 7, '0', STR_PAD_LEFT);
495
-        } elseif (! empty($musicinfo_id)) {
495
+        } elseif (!empty($musicinfo_id)) {
496 496
             $coverType = 'music';
497 497
             $coverId = $musicinfo_id;
498
-        } elseif (! empty($consoleinfo_id)) {
498
+        } elseif (!empty($consoleinfo_id)) {
499 499
             $coverType = 'console';
500 500
             $coverId = $consoleinfo_id;
501
-        } elseif (! empty($bookinfo_id)) {
501
+        } elseif (!empty($bookinfo_id)) {
502 502
             $coverType = 'book';
503 503
             $coverId = $bookinfo_id;
504
-        } elseif (! empty($gamesinfo_id)) {
504
+        } elseif (!empty($gamesinfo_id)) {
505 505
             $coverType = 'games';
506 506
             $coverId = $gamesinfo_id;
507
-        } elseif (! empty($xxxinfo_id)) {
507
+        } elseif (!empty($xxxinfo_id)) {
508 508
             $coverType = 'xxx';
509 509
             $coverId = $xxxinfo_id;
510
-        } elseif (! empty($anidbid) && $anidbid > 0) {
510
+        } elseif (!empty($anidbid) && $anidbid > 0) {
511 511
             $coverType = 'anime';
512 512
             $coverId = $anidbid;
513 513
         }
@@ -523,10 +523,10 @@  discard block
 block discarded – undo
523 523
     }
524 524
 }
525 525
 
526
-if (! function_exists('sanitize')) {
526
+if (!function_exists('sanitize')) {
527 527
     function sanitize(array|string $phrases, array $doNotSanitize = []): string
528 528
     {
529
-        if (! is_array($phrases)) {
529
+        if (!is_array($phrases)) {
530 530
             $wordArray = explode(' ', str_replace('.', ' ', $phrases));
531 531
         } else {
532 532
             $wordArray = $phrases;
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
         foreach ($wordArray as $words) {
538 538
             $words = preg_split('/\s+/', $words);
539 539
             foreach ($words as $st) {
540
-                if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) {
540
+                if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) {
541 541
                     $str = $st;
542
-                } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) {
542
+                } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) {
543 543
                     $str = $st;
544 544
                 } else {
545 545
                     $str = Sanitizer::escape($st, $doNotSanitize);
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
     }
555 555
 }
556 556
 
557
-if (! function_exists('formatBytes')) {
557
+if (!function_exists('formatBytes')) {
558 558
     /**
559 559
      * Format bytes into human-readable file size.
560 560
      *
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
     }
574 574
 }
575 575
 
576
-if (! function_exists('csp_nonce')) {
576
+if (!function_exists('csp_nonce')) {
577 577
     /**
578 578
      * Generate a CSP nonce for inline scripts
579 579
      * This should be stored in the request and reused across the request lifecycle
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
     }
591 591
 }
592 592
 
593
-if (! function_exists('userDate')) {
593
+if (!function_exists('userDate')) {
594 594
     /**
595 595
      * Format a date/time string according to the authenticated user's timezone
596 596
      *
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
     }
623 623
 }
624 624
 
625
-if (! function_exists('userDateDiffForHumans')) {
625
+if (!function_exists('userDateDiffForHumans')) {
626 626
     /**
627 627
      * Format a date/time string as a human-readable diff according to the authenticated user's timezone
628 628
      *
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
     }
654 654
 }
655 655
 
656
-if (! function_exists('getAvailableTimezones')) {
656
+if (!function_exists('getAvailableTimezones')) {
657 657
     /**
658 658
      * Get a list of available timezones grouped by region
659 659
      *
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
     }
684 684
 }
685 685
 
686
-if (! function_exists('countryCode')) {
686
+if (!function_exists('countryCode')) {
687 687
     /**
688 688
      * Get a country code for a country name.
689 689
      *
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
     }
703 703
 }
704 704
 
705
-if (! function_exists('unzipGzipFile')) {
705
+if (!function_exists('unzipGzipFile')) {
706 706
     /**
707 707
      * Unzip a gzip file, return the output. Return false on error / empty.
708 708
      *
@@ -713,12 +713,12 @@  discard block
 block discarded – undo
713 713
         $string = '';
714 714
         $gzFile = @gzopen($filePath, 'rb', 0);
715 715
         if ($gzFile) {
716
-            while (! gzeof($gzFile)) {
716
+            while (!gzeof($gzFile)) {
717 717
                 $temp = gzread($gzFile, 1024);
718 718
                 // Check for empty string.
719 719
                 // Without this the loop would be endless and consume 100% CPU.
720 720
                 // Do not set $string empty here, as the data might still be good.
721
-                if (! $temp) {
721
+                if (!$temp) {
722 722
                     break;
723 723
                 }
724 724
                 $string .= $temp;
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
     }
731 731
 }
732 732
 
733
-if (! function_exists('streamSslContextOptions')) {
733
+if (!function_exists('streamSslContextOptions')) {
734 734
     /**
735 735
      * Creates an array to be used with stream_context_create() to verify openssl certificates
736 736
      * when connecting to a tls or ssl connection when using stream functions (fopen/file_get_contents/etc).
@@ -746,13 +746,13 @@  discard block
 block discarded – undo
746 746
 
747 747
         // Base options - either insecure (no certs configured) or configured
748 748
         $options = [
749
-            'verify_peer' => ! $forceIgnore && $hasCustomCerts && config('nntmux_ssl.ssl_verify_peer', false),
750
-            'verify_peer_name' => ! $forceIgnore && $hasCustomCerts && config('nntmux_ssl.ssl_verify_host', false),
749
+            'verify_peer' => !$forceIgnore && $hasCustomCerts && config('nntmux_ssl.ssl_verify_peer', false),
750
+            'verify_peer_name' => !$forceIgnore && $hasCustomCerts && config('nntmux_ssl.ssl_verify_host', false),
751 751
             'allow_self_signed' => $forceIgnore ? true : config('nntmux_ssl.ssl_allow_self_signed', true),
752 752
         ];
753 753
 
754 754
         // Add certificate paths if configured
755
-        if ($hasCustomCerts && ! $forceIgnore) {
755
+        if ($hasCustomCerts && !$forceIgnore) {
756 756
             if ($cafile !== '') {
757 757
                 $options['cafile'] = $cafile;
758 758
             }
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
         }
763 763
 
764 764
         // Additional security options for modern TLS
765
-        $options['crypto_method'] = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT;
765
+        $options['crypto_method'] = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT;
766 766
         $options['disable_compression'] = true; // Prevent CRIME attacks
767 767
         $options['SNI_enabled'] = true; // Enable Server Name Indication
768 768
 
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
     }
774 774
 }
775 775
 
776
-if (! function_exists('getCoverURL')) {
776
+if (!function_exists('getCoverURL')) {
777 777
     function getCoverURL(array $options = []): string
778 778
     {
779 779
         $defaults = [
@@ -785,22 +785,21 @@  discard block
 block discarded – undo
785 785
         $fileSpecTemplate = '%s/%s%s';
786 786
         $fileSpec = '';
787 787
 
788
-        if (! empty($options['id']) && \in_array(
788
+        if (!empty($options['id']) && \in_array(
789 789
             $options['type'],
790 790
             ['anime', 'audio', 'audiosample', 'book', 'console', 'games', 'movies', 'music', 'preview', 'sample', 'tvrage', 'video', 'xxx'],
791 791
             false
792 792
         )
793 793
         ) {
794 794
             $fileSpec = sprintf($fileSpecTemplate, $options['type'], $options['id'], $options['suffix']);
795
-            $fileSpec = file_exists(storage_path('covers/').$fileSpec) ? $fileSpec :
796
-                sprintf($fileSpecTemplate, $options['type'], 'no', $options['suffix']);
795
+            $fileSpec = file_exists(storage_path('covers/').$fileSpec) ? $fileSpec : sprintf($fileSpecTemplate, $options['type'], 'no', $options['suffix']);
797 796
         }
798 797
 
799 798
         return $fileSpec;
800 799
     }
801 800
 }
802 801
 
803
-if (! function_exists('fileInfo')) {
802
+if (!function_exists('fileInfo')) {
804 803
     /**
805 804
      * Return file type/info using magic numbers.
806 805
      * Try using `file` program where available, fallback to using PHP's finfo class.
@@ -830,7 +829,7 @@  discard block
 block discarded – undo
830 829
     }
831 830
 }
832 831
 
833
-if (! function_exists('cp437toUTF')) {
832
+if (!function_exists('cp437toUTF')) {
834 833
     /**
835 834
      * Convert Code page 437 chars to UTF.
836 835
      */
@@ -840,7 +839,7 @@  discard block
 block discarded – undo
840 839
     }
841 840
 }
842 841
 
843
-if (! function_exists('imdb_trailers')) {
842
+if (!function_exists('imdb_trailers')) {
844 843
     /**
845 844
      * Fetches an embeddable video to a IMDB trailer from http://www.traileraddict.com.
846 845
      */
@@ -855,7 +854,7 @@  discard block
 block discarded – undo
855 854
     }
856 855
 }
857 856
 
858
-if (! function_exists('showApiError')) {
857
+if (!function_exists('showApiError')) {
859 858
     function showApiError(int $errorCode = 900, string $errorText = '')
860 859
     {
861 860
         $errorHeader = 'HTTP 1.1 400 Bad Request';
@@ -940,7 +939,7 @@  discard block
 block discarded – undo
940 939
     }
941 940
 }
942 941
 
943
-if (! function_exists('getRange')) {
942
+if (!function_exists('getRange')) {
944 943
     function getRange($tableName): \Illuminate\Contracts\Pagination\LengthAwarePaginator
945 944
     {
946 945
         $range = \Illuminate\Support\Facades\DB::table($tableName);
@@ -952,7 +951,7 @@  discard block
 block discarded – undo
952 951
     }
953 952
 }
954 953
 
955
-if (! function_exists('isValidNewznabNzb')) {
954
+if (!function_exists('isValidNewznabNzb')) {
956 955
     /**
957 956
      * Validate if the content is a valid Newznab NZB file.
958 957
      *
@@ -986,7 +985,7 @@  discard block
 block discarded – undo
986 985
     }
987 986
 }
988 987
 
989
-if (! function_exists('cli')) {
988
+if (!function_exists('cli')) {
990 989
     /**
991 990
      * Get the CLI helper instance for colored console output.
992 991
      *
Please login to merge, or discard this patch.
app/Console/Commands/TmuxMonitorCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
         cli()->header('Resetting expired collections. This may take some time...');
93 93
 
94 94
         try {
95
-            DB::transaction(function () use ($delayTime) {
95
+            DB::transaction(function() use ($delayTime) {
96 96
                 Collection::query()
97 97
                     ->where('dateadded', '<', now()->subHours($delayTime))
98 98
                     ->update(['dateadded' => now()]);
Please login to merge, or discard this patch.
app/Console/Commands/ReprocessTvRelease.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             [[
55 55
                 $release->id,
56 56
                 $release->guid,
57
-                mb_substr($release->searchname, 0, 60) . (strlen($release->searchname) > 60 ? '...' : ''),
57
+                mb_substr($release->searchname, 0, 60).(strlen($release->searchname) > 60 ? '...' : ''),
58 58
                 $release->videos_id,
59 59
                 $release->tv_episodes_id,
60 60
                 $release->categories_id,
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
 
82 82
             if ($result['matched']) {
83 83
                 cli()->primary('Successfully matched!');
84
-                $this->info('Provider: ' . ($result['provider'] ?? 'Unknown'));
85
-                $this->info('Video ID: ' . ($result['video_id'] ?? 'N/A'));
86
-                $this->info('Episode ID: ' . ($result['episode_id'] ?? 'N/A'));
84
+                $this->info('Provider: '.($result['provider'] ?? 'Unknown'));
85
+                $this->info('Video ID: '.($result['video_id'] ?? 'N/A'));
86
+                $this->info('Episode ID: '.($result['episode_id'] ?? 'N/A'));
87 87
             } else {
88 88
                 cli()->warning('No match found.');
89
-                $this->info('Status: ' . ($result['status'] ?? 'Unknown'));
89
+                $this->info('Status: '.($result['status'] ?? 'Unknown'));
90 90
                 if (isset($result['provider'])) {
91
-                    $this->info('Last provider tried: ' . $result['provider']);
91
+                    $this->info('Last provider tried: '.$result['provider']);
92 92
                 }
93 93
             }
94 94
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             return self::SUCCESS;
111 111
         } catch (\Throwable $e) {
112 112
             Log::error($e->getTraceAsString());
113
-            $this->error('Error processing release: ' . $e->getMessage());
113
+            $this->error('Error processing release: '.$e->getMessage());
114 114
             if ($debug) {
115 115
                 $this->error($e->getTraceAsString());
116 116
             }
Please login to merge, or discard this patch.
app/Console/Commands/TmuxStart.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             $this->layoutBuilder = new TmuxLayoutBuilder($this->sessionManager);
51 51
 
52 52
             // Check if tmux is installed
53
-            if (! $this->checkTmuxInstalled()) {
53
+            if (!$this->checkTmuxInstalled()) {
54 54
                 $this->error('❌ tmux is not installed');
55 55
 
56 56
                 return Command::FAILURE;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
             // Check if session already exists
60 60
             if ($this->sessionManager->sessionExists()) {
61
-                if (! $this->option('force')) {
61
+                if (!$this->option('force')) {
62 62
                     $this->error("❌ Session '{$sessionName}' already exists");
63 63
                     if ($this->confirm('Would you like to restart it?', false)) {
64 64
                         $this->call('tmux:stop', ['--session' => $sessionName]);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             $this->info("
Please login to merge, or discard this patch.