Passed
Push — master ( 4c3be3...04f1cf )
by Darko
02:53
created
Blacklight/Movie.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         $this->config->language = $this->lookuplanguage;
138 138
         $this->config->throwHttpExceptions = false;
139 139
         $cacheDir = storage_path('framework/cache/imdb_cache');
140
-        if (! File::isDirectory($cacheDir)) {
140
+        if (!File::isDirectory($cacheDir)) {
141 141
             File::makeDirectory($cacheDir, 0777, false, true);
142 142
         }
143 143
         $this->config->cachedir = $cacheDir;
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 					ORDER BY %s %s %s",
194 194
                 $this->showPasswords,
195 195
                 $this->getBrowseBy(),
196
-                (! empty($catsrch) ? $catsrch : ''),
196
+                (!empty($catsrch) ? $catsrch : ''),
197 197
                 (
198 198
                     $maxAge > 0
199 199
                         ? 'AND r.postdate > NOW() - INTERVAL '.$maxAge.'DAY '
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             Cache::put(md5($moviesSql.$page), $movies, $expiresAt);
214 214
         }
215 215
         $movieIDs = $releaseIDs = [];
216
-        if (! empty($movies['result'])) {
216
+        if (!empty($movies['result'])) {
217 217
             foreach ($movies['result'] as $movie => $id) {
218 218
                 $movieIDs[] = $id->imdbid;
219 219
                 $releaseIDs[] = $id->grp_release_id;
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 			AND r.id IN (%s) %s
253 253
 			GROUP BY m.imdbid
254 254
 			ORDER BY %s %s",
255
-            (\is_array($movieIDs) && ! empty($movieIDs) ? implode(',', $movieIDs) : -1),
256
-            (\is_array($releaseIDs) && ! empty($releaseIDs) ? implode(',', $releaseIDs) : -1),
257
-            (! empty($catsrch) ? $catsrch : ''),
255
+            (\is_array($movieIDs) && !empty($movieIDs) ? implode(',', $movieIDs) : -1),
256
+            (\is_array($releaseIDs) && !empty($releaseIDs) ? implode(',', $releaseIDs) : -1),
257
+            (!empty($catsrch) ? $catsrch : ''),
258 258
             $order[0],
259 259
             $order[1]
260 260
         );
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
         $browseBy = ' ';
301 301
         $browseByArr = ['title', 'director', 'actors', 'genre', 'rating', 'year', 'imdb'];
302 302
         foreach ($browseByArr as $bb) {
303
-            if (request()->has($bb) && ! empty(request()->input($bb))) {
303
+            if (request()->has($bb) && !empty(request()->input($bb))) {
304 304
                 $bbv = stripslashes(request()->input($bb));
305 305
                 if ($bb === 'rating') {
306 306
                     $bbv .= '.';
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
         if ($this->traktcheck !== null) {
335 335
             $data = $this->traktTv->client->movieSummary('tt'.$imdbId, 'full');
336
-            if (($data !== false) && ! empty($data['trailer'])) {
336
+            if (($data !== false) && !empty($data['trailer'])) {
337 337
                 return $data['trailer'];
338 338
             }
339 339
         }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
             return false;
360 360
         }
361 361
 
362
-        if (! empty($data['trailer'])) {
362
+        if (!empty($data['trailer'])) {
363 363
             $data['trailer'] = str_ireplace(
364 364
                 ['watch?v=', 'http://'],
365 365
                 ['embed/', 'https://'],
@@ -393,17 +393,17 @@  discard block
 block discarded – undo
393 393
      */
394 394
     private function checkTraktValue($value)
395 395
     {
396
-        if (\is_array($value) && ! empty($value)) {
396
+        if (\is_array($value) && !empty($value)) {
397 397
             $temp = '';
398 398
             foreach ($value as $val) {
399
-                if (! \is_array($val) && ! \is_object($val)) {
399
+                if (!\is_array($val) && !\is_object($val)) {
400 400
                     $temp .= $val;
401 401
                 }
402 402
             }
403 403
             $value = $temp;
404 404
         }
405 405
 
406
-        return ! empty($value) ? $value : '';
406
+        return !empty($value) ? $value : '';
407 407
     }
408 408
 
409 409
     /**
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
      */
425 425
     public function update(array $values): bool
426 426
     {
427
-        if (! \count($values)) {
427
+        if (!\count($values)) {
428 428
             return false;
429 429
         }
430 430
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
         $onDuplicateKey = ['created_at' => now()];
433 433
         $found = 0;
434 434
         foreach ($values as $key => $value) {
435
-            if (! empty($value)) {
435
+            if (!empty($value)) {
436 436
                 $found++;
437 437
                 if (\in_array($key, ['genre', 'language'], false)) {
438 438
                     $value = substr($value, 0, 64);
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                 $onDuplicateKey += [$key => $value];
442 442
             }
443 443
         }
444
-        if (! $found) {
444
+        if (!$found) {
445 445
             return false;
446 446
         }
447 447
         foreach ($query as $key => $value) {
@@ -458,19 +458,19 @@  discard block
 block discarded – undo
458 458
      */
459 459
     protected function setVariables(string|array $variable1, string|array $variable2, string|array $variable3, string|array $variable4, string|array $variable5)
460 460
     {
461
-        if (! empty($variable1)) {
461
+        if (!empty($variable1)) {
462 462
             return $variable1;
463 463
         }
464
-        if (! empty($variable2)) {
464
+        if (!empty($variable2)) {
465 465
             return $variable2;
466 466
         }
467
-        if (! empty($variable3)) {
467
+        if (!empty($variable3)) {
468 468
             return $variable3;
469 469
         }
470
-        if (! empty($variable4)) {
470
+        if (!empty($variable4)) {
471 471
             return $variable4;
472 472
         }
473
-        if (! empty($variable5)) {
473
+        if (!empty($variable5)) {
474 474
             return $variable5;
475 475
         }
476 476
 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 
506 506
         $iTunes = $this->fetchItunesMovieProperties($this->currentTitle);
507 507
 
508
-        if (! $imdb && ! $tmdb && ! $trakt && ! $omdb && empty($iTunes)) {
508
+        if (!$imdb && !$tmdb && !$trakt && !$omdb && empty($iTunes)) {
509 509
             return false;
510 510
         }
511 511
 
@@ -518,36 +518,36 @@  discard block
 block discarded – undo
518 518
         $mov['type'] = $mov['director'] = $mov['actors'] = $mov['language'] = '';
519 519
 
520 520
         $mov['imdbid'] = $imdbId;
521
-        $mov['tmdbid'] = (! isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid'];
522
-        $mov['traktid'] = (! isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id'];
521
+        $mov['tmdbid'] = (!isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid'];
522
+        $mov['traktid'] = (!isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id'];
523 523
 
524 524
         // Prefer Fanart.tv cover over TMDB,TMDB over IMDB,IMDB over OMDB and OMDB over iTunes.
525
-        if (! empty($fanart['cover'])) {
525
+        if (!empty($fanart['cover'])) {
526 526
             $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $fanart['cover'], $this->imgSavePath);
527
-        } elseif (! empty($tmdb['cover'])) {
527
+        } elseif (!empty($tmdb['cover'])) {
528 528
             $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $tmdb['cover'], $this->imgSavePath);
529
-        } elseif (! empty($imdb['cover'])) {
529
+        } elseif (!empty($imdb['cover'])) {
530 530
             $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $imdb['cover'], $this->imgSavePath);
531
-        } elseif (! empty($omdb['cover'])) {
531
+        } elseif (!empty($omdb['cover'])) {
532 532
             $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $omdb['cover'], $this->imgSavePath);
533
-        } elseif (! empty($iTunes['cover'])) {
533
+        } elseif (!empty($iTunes['cover'])) {
534 534
             $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $iTunes['cover'], $this->imgSavePath);
535 535
         }
536 536
 
537 537
         // Backdrops.
538
-        if (! empty($fanart['backdrop'])) {
538
+        if (!empty($fanart['backdrop'])) {
539 539
             $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $fanart['backdrop'], $this->imgSavePath, 1920, 1024);
540
-        } elseif (! empty($tmdb['backdrop'])) {
540
+        } elseif (!empty($tmdb['backdrop'])) {
541 541
             $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024);
542 542
         }
543 543
 
544 544
         // Banner
545
-        if (! empty($fanart['banner'])) {
545
+        if (!empty($fanart['banner'])) {
546 546
             $mov['banner'] = $this->releaseImage->saveImage($imdbId.'-banner', $fanart['banner'], $this->imgSavePath);
547 547
         }
548 548
 
549 549
         // RottenTomatoes rating from OmdbAPI
550
-        if ($omdb !== false && ! empty($omdb['rtRating'])) {
550
+        if ($omdb !== false && !empty($omdb['rtRating'])) {
551 551
             $mov['rtrating'] = $omdb['rtRating'];
552 552
         }
553 553
 
@@ -558,29 +558,29 @@  discard block
 block discarded – undo
558 558
         $mov['year'] = $this->setVariables($imdb['year'] ?? '', $tmdb['year'] ?? '', $trakt['year'] ?? '', $omdb['year'] ?? '', $iTunes['year'] ?? '');
559 559
         $mov['genre'] = $this->setVariables($imdb['genre'] ?? '', $tmdb['genre'] ?? '', $trakt['genres'] ?? '', $omdb['genre'] ?? '', $iTunes['genre'] ?? '');
560 560
 
561
-        if (! empty($imdb['type'])) {
561
+        if (!empty($imdb['type'])) {
562 562
             $mov['type'] = $imdb['type'];
563 563
         }
564 564
 
565
-        if (! empty($imdb['director'])) {
565
+        if (!empty($imdb['director'])) {
566 566
             $mov['director'] = \is_array($imdb['director']) ? implode(', ', array_unique($imdb['director'])) : $imdb['director'];
567
-        } elseif (! empty($omdb['director'])) {
567
+        } elseif (!empty($omdb['director'])) {
568 568
             $mov['director'] = \is_array($omdb['director']) ? implode(', ', array_unique($omdb['director'])) : $omdb['director'];
569
-        } elseif (! empty($tmdb['director'])) {
569
+        } elseif (!empty($tmdb['director'])) {
570 570
             $mov['director'] = \is_array($tmdb['director']) ? implode(', ', array_unique($tmdb['director'])) : $tmdb['director'];
571 571
         }
572 572
 
573
-        if (! empty($imdb['actors'])) {
573
+        if (!empty($imdb['actors'])) {
574 574
             $mov['actors'] = \is_array($imdb['actors']) ? implode(', ', array_unique($imdb['actors'])) : $imdb['actors'];
575
-        } elseif (! empty($omdb['actors'])) {
575
+        } elseif (!empty($omdb['actors'])) {
576 576
             $mov['actors'] = \is_array($omdb['actors']) ? implode(', ', array_unique($omdb['actors'])) : $omdb['actors'];
577
-        } elseif (! empty($tmdb['actors'])) {
577
+        } elseif (!empty($tmdb['actors'])) {
578 578
             $mov['actors'] = \is_array($tmdb['actors']) ? implode(', ', array_unique($tmdb['actors'])) : $tmdb['actors'];
579 579
         }
580 580
 
581
-        if (! empty($imdb['language'])) {
581
+        if (!empty($imdb['language'])) {
582 582
             $mov['language'] = \is_array($imdb['language']) ? implode(', ', array_unique($imdb['language'])) : $imdb['language'];
583
-        } elseif (! empty($omdb['language']) && ! is_bool($omdb['language'])) {
583
+        } elseif (!empty($omdb['language']) && !is_bool($omdb['language'])) {
584 584
             $mov['language'] = \is_array($omdb['language']) ? implode(', ', array_unique($omdb['language'])) : $omdb['language'];
585 585
         }
586 586
 
@@ -638,20 +638,20 @@  discard block
 block discarded – undo
638 638
         if ($this->fanartapikey !== null) {
639 639
             $art = $this->fanart->getMovieFanArt('tt'.$imdbId);
640 640
 
641
-            if (! empty($art)) {
641
+            if (!empty($art)) {
642 642
                 if (isset($art['status']) && $art['status'] === 'error') {
643 643
                     return false;
644 644
                 }
645 645
                 $ret = [];
646
-                if (! empty($art['moviebackground'][0]['url'])) {
646
+                if (!empty($art['moviebackground'][0]['url'])) {
647 647
                     $ret['backdrop'] = $art['moviebackground'][0]['url'];
648
-                } elseif (! empty($art['moviethumb'][0]['url'])) {
648
+                } elseif (!empty($art['moviethumb'][0]['url'])) {
649 649
                     $ret['backdrop'] = $art['moviethumb'][0]['url'];
650 650
                 }
651
-                if (! empty($art['movieposter'][0]['url'])) {
651
+                if (!empty($art['movieposter'][0]['url'])) {
652 652
                     $ret['cover'] = $art['movieposter'][0]['url'];
653 653
                 }
654
-                if (! empty($art['moviebanner'][0]['url'])) {
654
+                if (!empty($art['moviebanner'][0]['url'])) {
655 655
                     $ret['banner'] = $art['moviebanner'][0]['url'];
656 656
                 }
657 657
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
             return false;
689 689
         }
690 690
 
691
-        if (! empty($tmdbLookup)) {
691
+        if (!empty($tmdbLookup)) {
692 692
             if ($this->currentTitle !== '') {
693 693
                 // Check the similarity.
694 694
                 similar_text($this->currentTitle, $tmdbLookup['title'], $percent);
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
                 $ret['rating'] = '';
718 718
             }
719 719
             $actors = Arr::pluck($tmdbLookup['credits']['cast'], 'name');
720
-            if (! empty($actors)) {
720
+            if (!empty($actors)) {
721 721
                 $ret['actors'] = $actors;
722 722
             } else {
723 723
                 $ret['actors'] = '';
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
                 }
729 729
             }
730 730
             $overview = $tmdbLookup['overview'];
731
-            if (! empty($overview)) {
731
+            if (!empty($overview)) {
732 732
                 $ret['plot'] = $overview;
733 733
             } else {
734 734
                 $ret['plot'] = '';
@@ -738,13 +738,13 @@  discard block
 block discarded – undo
738 738
             $ret['tagline'] = $tagline ?? '';
739 739
 
740 740
             $released = $tmdbLookup['release_date'];
741
-            if (! empty($released)) {
741
+            if (!empty($released)) {
742 742
                 $ret['year'] = Carbon::parse($released)->year;
743 743
             } else {
744 744
                 $ret['year'] = '';
745 745
             }
746 746
             $genresa = $tmdbLookup['genres'];
747
-            if (! empty($genresa) && \count($genresa) > 0) {
747
+            if (!empty($genresa) && \count($genresa) > 0) {
748 748
                 $genres = [];
749 749
                 foreach ($genresa as $genre) {
750 750
                     $genres[] = $genre['name'];
@@ -754,13 +754,13 @@  discard block
 block discarded – undo
754 754
                 $ret['genre'] = '';
755 755
             }
756 756
             $posterp = $tmdbLookup['poster_path'];
757
-            if (! empty($posterp)) {
757
+            if (!empty($posterp)) {
758 758
                 $ret['cover'] = 'https://image.tmdb.org/t/p/original'.$posterp;
759 759
             } else {
760 760
                 $ret['cover'] = '';
761 761
             }
762 762
             $backdrop = $tmdbLookup['backdrop_path'];
763
-            if (! empty($backdrop)) {
763
+            if (!empty($backdrop)) {
764 764
                 $ret['backdrop'] = 'https://image.tmdb.org/t/p/original'.$backdrop;
765 765
             } else {
766 766
                 $ret['backdrop'] = '';
@@ -782,9 +782,9 @@  discard block
 block discarded – undo
782 782
     {
783 783
         $realId = (new Title($imdbId, $this->config))->real_id();
784 784
         $result = new Title($realId, $this->config);
785
-        $title = ! empty($result->orig_title()) ? $result->orig_title() : $result->title();
786
-        if (! empty($title)) {
787
-            if (! empty($this->currentTitle)) {
785
+        $title = !empty($result->orig_title()) ? $result->orig_title() : $result->title();
786
+        if (!empty($title)) {
787
+            if (!empty($this->currentTitle)) {
788 788
                 similar_text($this->currentTitle, $title, $percent);
789 789
                 if ($percent >= self::MATCH_PERCENT) {
790 790
                     similar_text($this->currentYear, $result->year(), $percent);
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
                             'title' => $title,
794 794
                             'tagline' => $result->tagline() ?? '',
795 795
                             'plot' => Arr::get($result->plot_split(), '0.plot'),
796
-                            'rating' => ! empty($result->rating()) ? $result->rating() : '',
796
+                            'rating' => !empty($result->rating()) ? $result->rating() : '',
797 797
                             'year' => $result->year() ?? '',
798 798
                             'cover' => $result->photo() ?? '',
799 799
                             'genre' => $result->genre() ?? '',
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
                 'title' => $title,
819 819
                 'tagline' => $result->tagline() ?? '',
820 820
                 'plot' => Arr::get($result->plot_split(), '0.plot'),
821
-                'rating' => ! empty($result->rating()) ? $result->rating() : '',
821
+                'rating' => !empty($result->rating()) ? $result->rating() : '',
822 822
                 'year' => $result->year() ?? '',
823 823
                 'cover' => $result->photo() ?? '',
824 824
                 'genre' => $result->genre() ?? '',
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
         if ($this->omdbapikey !== null) {
893 893
             $resp = $this->omdbApi->fetch('i', 'tt'.$imdbId);
894 894
 
895
-            if (\is_object($resp) && $resp->message === 'OK' && ! Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') {
895
+            if (\is_object($resp) && $resp->message === 'OK' && !Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') {
896 896
                 similar_text($this->currentTitle, $resp->data->Title, $percent);
897 897
                 if ($percent >= self::MATCH_PERCENT) {
898 898
                     similar_text($this->currentYear, $resp->data->Year, $percent);
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
             // Loop over releases.
1059 1059
             foreach ($res as $arr) {
1060 1060
                 // Try to get a name/year.
1061
-                if (! $this->parseMovieSearchName($arr['searchname'])) {
1061
+                if (!$this->parseMovieSearchName($arr['searchname'])) {
1062 1062
                     // We didn't find a name, so set to all 0's so we don't parse again.
1063 1063
                     Release::query()->where('id', $arr['id'])->update(['imdbid' => 0000000]);
1064 1064
 
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
                     try {
1093 1093
                         $imdbSearch = new TitleSearch($this->config);
1094 1094
                         foreach ($imdbSearch->search($this->currentTitle, [TitleSearch::MOVIE]) as $imdbTitle) {
1095
-                            if (! empty($imdbTitle->title())) {
1095
+                            if (!empty($imdbTitle->title())) {
1096 1096
                                 similar_text($imdbTitle->title(), $this->currentTitle, $percent);
1097 1097
                                 if ($percent >= self::MATCH_PERCENT) {
1098 1098
                                     similar_text($this->currentYear, $imdbTitle->year(), $percent);
@@ -1122,10 +1122,10 @@  discard block
 block discarded – undo
1122 1122
                             $buffer = $this->omdbApi->search($omdbTitle, 'movie');
1123 1123
                         }
1124 1124
 
1125
-                        if (\is_object($buffer) && $buffer->message === 'OK' && ! Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') {
1125
+                        if (\is_object($buffer) && $buffer->message === 'OK' && !Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') {
1126 1126
                             $getIMDBid = $buffer->data->Search[0]->imdbID;
1127 1127
 
1128
-                            if (! empty($getIMDBid)) {
1128
+                            if (!empty($getIMDBid)) {
1129 1129
                                 $imdbId = $this->doMovieUpdate($getIMDBid, 'OMDbAPI', $arr['id']);
1130 1130
                                 if ($imdbId !== false) {
1131 1131
                                     $movieUpdated = true;
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
                     $data = $this->traktTv->client->movieSummary($movieName, 'full');
1141 1141
                     if ($data !== false) {
1142 1142
                         $this->parseTraktTv($data);
1143
-                        if (! empty($data['ids']['imdb'])) {
1143
+                        if (!empty($data['ids']['imdb'])) {
1144 1144
                             $imdbId = $this->doMovieUpdate($data['ids']['imdb'], 'Trakt', $arr['id']);
1145 1145
                             if ($imdbId !== false) {
1146 1146
                                 $movieUpdated = true;
@@ -1153,13 +1153,13 @@  discard block
 block discarded – undo
1153 1153
                 if ($movieUpdated === false) {
1154 1154
                     try {
1155 1155
                         $data = Tmdb::getSearchApi()->searchMovies($this->currentTitle);
1156
-                        if (($data['total_results'] > 0) && ! empty($data['results'])) {
1156
+                        if (($data['total_results'] > 0) && !empty($data['results'])) {
1157 1157
                             foreach ($data['results'] as $result) {
1158
-                                if (! empty($result['id']) && ! empty($result['release_date'])) {
1158
+                                if (!empty($result['id']) && !empty($result['release_date'])) {
1159 1159
                                     similar_text($this->currentYear, Carbon::parse($result['release_date'])->year, $percent);
1160 1160
                                     if ($percent >= self::YEAR_MATCH_PERCENT) {
1161 1161
                                         $ret = $this->fetchTMDBProperties($result['id'], true);
1162
-                                        if ($ret !== false && ! empty($ret['imdbid'])) {
1162
+                                        if ($ret !== false && !empty($ret['imdbid'])) {
1163 1163
                                             $imdbId = $this->doMovieUpdate('tt'.$ret['imdbid'], 'TMDB', $arr['id']);
1164 1164
                                             if ($imdbId !== false) {
1165 1165
                                                 $movieUpdated = true;
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
             // Finally remove multiple spaces and trim leading spaces.
1261 1261
             $name = trim(preg_replace('/\s{2,}/', ' ', $name));
1262 1262
             // Check if the name is long enough and not just numbers.
1263
-            if (\strlen($name) > 4 && ! preg_match('/^\d+$/', $name)) {
1263
+            if (\strlen($name) > 4 && !preg_match('/^\d+$/', $name)) {
1264 1264
                 $this->currentTitle = $name;
1265 1265
                 $this->currentYear = $year;
1266 1266
 
Please login to merge, or discard this patch.
Blacklight/ElasticSearchSiteSearch.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -277,8 +277,8 @@
 block discarded – undo
277 277
 
278 278
             // Execute a Scroll request and repeat
279 279
             $results = Elasticsearch::scroll([
280
-                'scroll_id' => $scroll_id,  // ...using our previously obtained _scroll_id
281
-                'scroll' => '30s',        // and the same timeout window
280
+                'scroll_id' => $scroll_id, // ...using our previously obtained _scroll_id
281
+                'scroll' => '30s', // and the same timeout window
282 282
             ]
283 283
             );
284 284
         }
Please login to merge, or discard this patch.
Blacklight/libraries/Forking.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -266,14 +266,14 @@  discard block
 block discarded – undo
266 266
         $this->processWork();
267 267
         $maxWork = \count($this->work);
268 268
         foreach ($this->work as $group) {
269
-            $pool->add(function () use ($group) {
269
+            $pool->add(function() use ($group) {
270 270
                 return $this->_executeCommand(PHP_BINARY.' misc/update/backfill.php '.$group->name.(isset($group->max) ? (' '.$group->max) : ''));
271
-            }, 2000000)->then(function ($output) use ($group, $maxWork) {
271
+            }, 2000000)->then(function($output) use ($group, $maxWork) {
272 272
                 echo $output;
273 273
                 $this->colorCli->primary('Task #'.$maxWork.' Backfilled group '.$group->name);
274
-            })->catch(function (\Throwable $exception) {
274
+            })->catch(function(\Throwable $exception) {
275 275
                 echo $exception->getMessage();
276
-            })->catch(static function (SerializableException $serializableException) {
276
+            })->catch(static function(SerializableException $serializableException) {
277 277
                 // we do nothing here just catch the error and move on
278 278
             });
279 279
             $maxWork--;
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         );
340 340
 
341 341
         $count = 0;
342
-        if (! empty($data) && isset($data[0]->name)) {
342
+        if (!empty($data) && isset($data[0]->name)) {
343 343
             $this->safeBackfillGroup = $data[0]->name;
344 344
 
345 345
             $count = ($data[0]->our_first - $data[0]->their_first);
@@ -361,14 +361,14 @@  discard block
 block discarded – undo
361 361
 
362 362
             $this->processWork();
363 363
             foreach ($queues as $queue) {
364
-                $pool->add(function () use ($queue) {
364
+                $pool->add(function() use ($queue) {
365 365
                     return $this->_executeCommand($this->dnr_path.$queue.'"');
366
-                }, 2000000)->then(function ($output) {
366
+                }, 2000000)->then(function($output) {
367 367
                     echo $output;
368 368
                     $this->colorCli->primary('Backfilled group '.$this->safeBackfillGroup);
369
-                })->catch(function (\Throwable $exception) {
369
+                })->catch(function(\Throwable $exception) {
370 370
                     echo $exception->getMessage();
371
-                })->catch(static function (SerializableException $serializableException) {
371
+                })->catch(static function(SerializableException $serializableException) {
372 372
                     // we do nothing here just catch the error and move on
373 373
                 });
374 374
             }
@@ -401,14 +401,14 @@  discard block
 block discarded – undo
401 401
 
402 402
         $this->processWork();
403 403
         foreach ($this->work as $group) {
404
-            $pool->add(function () use ($group) {
404
+            $pool->add(function() use ($group) {
405 405
                 return $this->_executeCommand(PHP_BINARY.' misc/update/update_binaries.php '.$group->name.' '.$group->max);
406
-            }, 2000000)->then(function ($output) use ($group, $maxWork) {
406
+            }, 2000000)->then(function($output) use ($group, $maxWork) {
407 407
                 echo $output;
408 408
                 $this->colorCli->primary('Task #'.$maxWork.' Updated group '.$group->name);
409
-            })->catch(function (\Throwable $exception) {
409
+            })->catch(function(\Throwable $exception) {
410 410
                 echo $exception->getMessage();
411
-            })->catch(static function (SerializableException $serializableException) {
411
+            })->catch(static function(SerializableException $serializableException) {
412 412
                 // we do nothing here just catch the error and move on
413 413
             });
414 414
             $maxWork--;
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 			ORDER BY a.last_record DESC'
436 436
         );
437 437
 
438
-        if (! empty($this->work)) {
438
+        if (!empty($this->work)) {
439 439
             $i = 1;
440 440
             $queues = [];
441 441
             foreach ($this->work as $group) {
@@ -468,16 +468,16 @@  discard block
 block discarded – undo
468 468
             $this->processWork();
469 469
             foreach ($queues as $queue) {
470 470
                 preg_match('/alt\..+/i', $queue, $hit);
471
-                $pool->add(function () use ($queue) {
471
+                $pool->add(function() use ($queue) {
472 472
                     return $this->_executeCommand($this->dnr_path.$queue.'"');
473
-                }, 2000000)->then(function ($output) use ($hit) {
474
-                    if (! empty($hit)) {
473
+                }, 2000000)->then(function($output) use ($hit) {
474
+                    if (!empty($hit)) {
475 475
                         echo $output;
476 476
                         $this->colorCli->primary('Updated group '.$hit[0]);
477 477
                     }
478
-                })->catch(function (\Throwable $exception) {
478
+                })->catch(function(\Throwable $exception) {
479 479
                     echo $exception->getMessage();
480
-                })->catch(static function (SerializableException $serializableException) {
480
+                })->catch(static function(SerializableException $serializableException) {
481 481
                     // we do nothing here just catch the error and move on
482 482
                 });
483 483
             }
@@ -540,14 +540,14 @@  discard block
 block discarded – undo
540 540
 
541 541
         $this->processWork();
542 542
         foreach ($this->work as $queue) {
543
-            $pool->add(function () use ($queue) {
543
+            $pool->add(function() use ($queue) {
544 544
                 return $this->_executeCommand(PHP_BINARY.' misc/update/tmux/bin/groupfixrelnames.php "'.$queue.'"'.' true');
545
-            }, 2000000)->then(function ($output) use ($maxWork) {
545
+            }, 2000000)->then(function($output) use ($maxWork) {
546 546
                 echo $output;
547 547
                 $this->colorCli->primary('Task #'.$maxWork.' Finished fixing releases names');
548
-            })->catch(function (\Throwable $exception) {
548
+            })->catch(function(\Throwable $exception) {
549 549
                 echo $exception->getMessage();
550
-            })->catch(static function (SerializableException $serializableException) {
550
+            })->catch(static function(SerializableException $serializableException) {
551 551
                 // we do nothing here just catch the error and move on
552 552
             });
553 553
             $maxWork--;
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
         foreach ($work as $group) {
569 569
             try {
570 570
                 $query = DB::select(sprintf('SELECT id FROM collections WHERE groups_id = %d LIMIT 1', $group->id));
571
-                if (! empty($query)) {
571
+                if (!empty($query)) {
572 572
                     $uGroups[] = ['id' => $group->id, 'name' => $group->name];
573 573
                 }
574 574
             } catch (\PDOException $e) {
@@ -586,14 +586,14 @@  discard block
 block discarded – undo
586 586
 
587 587
         $this->processWork();
588 588
         foreach ($uGroups as $group) {
589
-            $pool->add(function () use ($group) {
589
+            $pool->add(function() use ($group) {
590 590
                 return $this->_executeCommand($this->dnr_path.'releases  '.$group['id'].'"');
591
-            }, 2000000)->then(function ($output) use ($maxWork) {
591
+            }, 2000000)->then(function($output) use ($maxWork) {
592 592
                 echo $output;
593 593
                 $this->colorCli->primary('Task #'.$maxWork.' Finished performing release processing');
594
-            })->catch(function (\Throwable $exception) {
594
+            })->catch(function(\Throwable $exception) {
595 595
                 echo $exception->getMessage();
596
-            })->catch(static function (SerializableException $serializableException) {
596
+            })->catch(static function(SerializableException $serializableException) {
597 597
                 // we do nothing here just catch the error and move on
598 598
             });
599 599
             $maxWork--;
@@ -630,16 +630,16 @@  discard block
 block discarded – undo
630 630
         $this->processWork();
631 631
         foreach ($releases as $release) {
632 632
             if ($type !== '') {
633
-                $pool->add(function () use ($release, $type) {
633
+                $pool->add(function() use ($release, $type) {
634 634
                     return $this->_executeCommand(PHP_BINARY.' misc/update/postprocess.php '.$type.$release->id);
635
-                }, 2000000)->then(function ($output) use ($desc, $count) {
635
+                }, 2000000)->then(function($output) use ($desc, $count) {
636 636
                     echo $output;
637 637
                     $this->colorCli->primary('Finished task #'.$count.' for '.$desc);
638
-                })->catch(function (\Throwable $exception) {
638
+                })->catch(function(\Throwable $exception) {
639 639
                     echo $exception->getMessage();
640
-                })->catch(static function (SerializableException $serializableException) {
640
+                })->catch(static function(SerializableException $serializableException) {
641 641
                     // we do nothing here just catch the error and move on
642
-                })->timeout(function () use ($count) {
642
+                })->timeout(function() use ($count) {
643 643
                     $this->colorCli->notice('Task #'.$count.': Timeout occurred.');
644 644
                 });
645 645
                 $count--;
@@ -865,15 +865,15 @@  discard block
 block discarded – undo
865 865
         $pool = Pool::create()->concurrency($maxProcess)->timeout(config('nntmux.multiprocessing_max_child_time'));
866 866
         $this->processWork();
867 867
         foreach ($this->work as $group) {
868
-            $pool->add(function () use ($group) {
868
+            $pool->add(function() use ($group) {
869 869
                 return $this->_executeCommand($this->dnr_path.'update_per_group  '.$group->id.'"');
870
-            }, 2000000)->then(function ($output) use ($group) {
870
+            }, 2000000)->then(function($output) use ($group) {
871 871
                 echo $output;
872 872
                 $name = UsenetGroup::getNameByID($group->id);
873 873
                 $this->colorCli->primary('Finished updating binaries, processing releases and additional postprocessing for group:'.$name);
874
-            })->catch(function (\Throwable $exception) {
874
+            })->catch(function(\Throwable $exception) {
875 875
                 echo $exception->getMessage();
876
-            })->catch(static function (SerializableException $serializableException) {
876
+            })->catch(static function(SerializableException $serializableException) {
877 877
                 echo $serializableException->asThrowable()->getMessage();
878 878
             });
879 879
         }
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
     {
890 890
         $process = Process::fromShellCommandline($command);
891 891
         $process->setTimeout(1800);
892
-        $process->run(function ($type, $buffer) {
892
+        $process->run(function($type, $buffer) {
893 893
             if ($type === Process::ERR) {
894 894
                 echo $buffer;
895 895
             }
Please login to merge, or discard this patch.
misc/update/tmux/run.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 // reset collections dateadded to now if dateadded > delay time check
21 21
 $colorCli->header('Resetting collections that have expired to this moment. This could take some time if many collections need to be reset');
22 22
 
23
-DB::transaction(function () use ($delaytime) {
23
+DB::transaction(function() use ($delaytime) {
24 24
     Collection::query()->where('dateadded', '<', now()->subHours($delaytime))->update(['dateadded' => now()]);
25 25
 }, 10);
26 26
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 // check for apps
35 35
 $apps = ['time', 'tmux', 'nice', 'tee'];
36 36
 foreach ($apps as &$value) {
37
-    if (! command_exist($value)) {
37
+    if (!command_exist($value)) {
38 38
         $colorCli->error('Tmux scripts require '.$value.' but its not installed. Aborting.');
39 39
         exit();
40 40
     }
Please login to merge, or discard this patch.
misc/update/tmux/monitor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
     $runVar['settings'] = (array) Arr::first(DB::select($tRun->getMonitorSettings()));
78 78
     $runVar['timers']['query']['tmux_time'] = (time() - $timer01);
79 79
 
80
-    $runVar['settings']['book_reqids'] = (! empty($runVar['settings']['book_reqids'])
80
+    $runVar['settings']['book_reqids'] = (!empty($runVar['settings']['book_reqids'])
81 81
         ? $runVar['settings']['book_reqids'] : Category::BOOKS_ROOT);
82 82
 
83 83
     // get usenet connection info
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/ForgotPasswordController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         if (empty($email) && empty($rssToken)) {
44 44
             app('smarty.view')->assign('error', 'Missing parameter (email and/or apikey) to send password reset');
45 45
         } else {
46
-            if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) {
46
+            if (config('captcha.enabled') === true && (!empty(config('captcha.secret')) && !empty(config('captcha.sitekey')))) {
47 47
                 $validate = Validator::make($request->all(), [
48 48
                     'g-recaptcha-response' => 'required|captcha',
49 49
                 ]);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             //
55 55
             // Check users exists and send an email
56 56
             //
57
-            $ret = ! empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email);
57
+            $ret = !empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email);
58 58
             if ($ret === null) {
59 59
                 app('smarty.view')->assign('error', 'The email or apikey are not recognised.');
60 60
             } else {
Please login to merge, or discard this patch.
Blacklight/Releases.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
             $query->where('postdate', '>', now()->subDays($maxAge));
71 71
         }
72 72
 
73
-        if (! empty($excludedCats)) {
73
+        if (!empty($excludedCats)) {
74 74
             $query->whereNotIn('categories_id', $excludedCats);
75 75
         }
76 76
 
77 77
         if ($groupName !== -1) {
78
-            $query->whereHas('group', function ($q) use ($groupName) {
78
+            $query->whereHas('group', function($q) use ($groupName) {
79 79
                 $q->where('name', $groupName);
80 80
             });
81 81
         }
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
             ->where('nzbstatus', NZB::NZB_ADDED)
242 242
             ->where('passwordstatus', $this->showPasswords())
243 243
             ->whereBetween('categories_id', [Category::TV_ROOT, Category::TV_OTHER])
244
-            ->when($maxAge > 0, function ($q) use ($maxAge) {
244
+            ->when($maxAge > 0, function($q) use ($maxAge) {
245 245
                 $q->where('postdate', '>', now()->subDays($maxAge));
246 246
             })
247
-            ->when(! empty($excludedCats), function ($q) use ($excludedCats) {
247
+            ->when(!empty($excludedCats), function($q) use ($excludedCats) {
248 248
                 $q->whereNotIn('categories_id', $excludedCats);
249 249
             })
250 250
             ->whereRaw($this->uSQL($userShows, 'videos_id'))
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     {
321 321
         // Delete NZB from disk.
322 322
         $nzbPath = $nzb->NZBPath($identifiers['g']);
323
-        if (! empty($nzbPath)) {
323
+        if (!empty($nzbPath)) {
324 324
             File::delete($nzbPath);
325 325
         }
326 326
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
      */
361 361
     public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId)
362 362
     {
363
-        if (! \is_array($guids) || \count($guids) < 1) {
363
+        if (!\is_array($guids) || \count($guids) < 1) {
364 364
             return false;
365 365
         }
366 366
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
         $sql = '(1=2 ';
385 385
         foreach ($userQuery as $query) {
386 386
             $sql .= sprintf('OR (r.%s = %d', $type, $query->$type);
387
-            if (! empty($query->categories)) {
387
+            if (!empty($query->categories)) {
388 388
                 $catsArr = explode('|', $query->categories);
389 389
                 if (\count($catsArr) > 1) {
390 390
                     $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr));
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
             $orderBy = $this->getBrowseOrder($orderBy);
427 427
         }
428 428
 
429
-        $searchFields = Arr::where($searchArr, static function ($value) {
429
+        $searchFields = Arr::where($searchArr, static function($value) {
430 430
             return $value !== -1;
431 431
         });
432 432
 
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
             $searchResult = $this->elasticSearch->indexSearch($phrases, $limit);
437 437
         } else {
438 438
             $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', '', [], $searchFields);
439
-            if (! empty($searchResult)) {
439
+            if (!empty($searchResult)) {
440 440
                 $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
441 441
             }
442 442
         }
@@ -464,12 +464,12 @@  discard block
 block discarded – undo
464 464
             $query->where('postdate', '>', now()->subDays($maxAge));
465 465
         }
466 466
 
467
-        if (! empty($excludedCats)) {
467
+        if (!empty($excludedCats)) {
468 468
             $query->whereNotIn('categories_id', $excludedCats);
469 469
         }
470 470
 
471 471
         if ((int) $groupName !== -1) {
472
-            $query->whereHas('group', function ($q) use ($groupName) {
472
+            $query->whereHas('group', function($q) use ($groupName) {
473 473
                 $q->where('name', $groupName);
474 474
             });
475 475
         }
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
                 $searchResult = $this->elasticSearch->indexSearchApi($searchName, $limit);
535 535
             } else {
536 536
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $searchName, ['searchname']);
537
-                if (! empty($searchResult)) {
537
+                if (!empty($searchResult)) {
538 538
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
539 539
                 }
540 540
             }
@@ -549,12 +549,12 @@  discard block
 block discarded – undo
549 549
             $query->where('postdate', '>', now()->subDays($maxAge));
550 550
         }
551 551
 
552
-        if (! empty($excludedCats)) {
552
+        if (!empty($excludedCats)) {
553 553
             $query->whereNotIn('categories_id', $excludedCats);
554 554
         }
555 555
 
556 556
         if ((int) $groupName !== -1) {
557
-            $query->whereHas('group', function ($q) use ($groupName) {
557
+            $query->whereHas('group', function($q) use ($groupName) {
558 558
                 $q->where('name', $groupName);
559 559
             });
560 560
         }
@@ -626,11 +626,11 @@  discard block
 block discarded – undo
626 626
             $show = self::fromQuery($showQry);
627 627
 
628 628
             if ($show->isNotEmpty()) {
629
-                if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') {
629
+                if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') {
630 630
                     $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series;
631
-                } elseif (! empty($episode) && $show[0]->episodes !== '') {
631
+                } elseif (!empty($episode) && $show[0]->episodes !== '') {
632 632
                     $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes);
633
-                } elseif (! empty($series) && empty($episode)) {
633
+                } elseif (!empty($series) && empty($episode)) {
634 634
                     // If $series is set but episode is not, return Season Packs and Episodes
635 635
                     $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series;
636 636
                 }
@@ -644,26 +644,26 @@  discard block
 block discarded – undo
644 644
         }
645 645
 
646 646
         // If $name is set it is a fallback search, add available SxxExx/airdate info to the query
647
-        if (! empty($name) && $showSql === '') {
648
-            if (! empty($series) && (int) $series < 1900) {
647
+        if (!empty($name) && $showSql === '') {
648
+            if (!empty($series) && (int) $series < 1900) {
649 649
                 $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT));
650
-                if (! empty($episode) && ! str_contains($episode, '/')) {
650
+                if (!empty($episode) && !str_contains($episode, '/')) {
651 651
                     $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT));
652 652
                 }
653 653
                 // If season is not empty but episode is, add a wildcard to the search
654 654
                 if (empty($episode)) {
655 655
                     $name .= '*';
656 656
                 }
657
-            } elseif (! empty($airDate)) {
657
+            } elseif (!empty($airDate)) {
658 658
                 $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate));
659 659
             }
660 660
         }
661
-        if (! empty($name)) {
661
+        if (!empty($name)) {
662 662
             if (config('nntmux.elasticsearch_enabled') === true) {
663 663
                 $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit);
664 664
             } else {
665 665
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']);
666
-                if (! empty($searchResult)) {
666
+                if (!empty($searchResult)) {
667 667
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
668 668
                 }
669 669
             }
@@ -679,11 +679,11 @@  discard block
 block discarded – undo
679 679
             NZB::NZB_ADDED,
680 680
             $this->showPasswords(),
681 681
             $showSql,
682
-            (! empty($name) && ! empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '',
682
+            (!empty($name) && !empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '',
683 683
             Category::getCategorySearch($cat, 'tv'),
684 684
             $maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : '',
685 685
             $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '',
686
-            ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : ''
686
+            !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : ''
687 687
         );
688 688
         $baseSql = sprintf(
689 689
             "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus,
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
         if ($releases !== null) {
721 721
             return $releases;
722 722
         }
723
-        $releases = ((! empty($name) && ! empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : [];
723
+        $releases = ((!empty($name) && !empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : [];
724 724
         if (count($releases) !== 0 && $releases->isNotEmpty()) {
725 725
             $releases[0]->_totalrows = $this->getPagerCount(
726 726
                 preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql)
@@ -746,23 +746,23 @@  discard block
 block discarded – undo
746 746
             ->whereIn('categories_id', Category::getCategorySearch($cat, 'tv', true));
747 747
 
748 748
         // Check if siteIdArr contains id key
749
-        if (! empty($siteIdArr) && array_key_exists('id', $siteIdArr) && $siteIdArr['id'] > 0) {
749
+        if (!empty($siteIdArr) && array_key_exists('id', $siteIdArr) && $siteIdArr['id'] > 0) {
750 750
             $query->where('videos_id', $siteIdArr['id']);
751 751
         }
752
-        if (! empty($series)) {
753
-            $query->whereHas('episode', function ($q) use ($series, $episode, $airDate) {
752
+        if (!empty($series)) {
753
+            $query->whereHas('episode', function($q) use ($series, $episode, $airDate) {
754 754
                 $q->where('series', (int) preg_replace('/^s0*/i', '', $series));
755
-                if (! empty($episode)) {
755
+                if (!empty($episode)) {
756 756
                     $q->where('episode', (int) preg_replace('/^e0*/i', '', $episode));
757 757
                 }
758
-                if (! empty($airDate)) {
758
+                if (!empty($airDate)) {
759 759
                     $q->whereDate('firstaired', $airDate);
760 760
                 }
761 761
             });
762 762
         }
763 763
 
764
-        if (! empty(array_filter($siteIdArr))) {
765
-            $query->whereHas('video', function ($q) use ($siteIdArr) {
764
+        if (!empty(array_filter($siteIdArr))) {
765
+            $query->whereHas('video', function($q) use ($siteIdArr) {
766 766
                 foreach ($siteIdArr as $column => $id) {
767 767
                     if ($id > 0 && $column !== 'id') {
768 768
                         $q->orWhere($column, $id);
@@ -772,18 +772,18 @@  discard block
 block discarded – undo
772 772
             });
773 773
         }
774 774
 
775
-        if (! empty($name)) {
775
+        if (!empty($name)) {
776 776
             // If $name is set it is a fallback search, add available SxxExx/airdate info to the query
777
-            if (! empty($series) && (int) $series < 1900) {
777
+            if (!empty($series) && (int) $series < 1900) {
778 778
                 $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT));
779
-                if (! empty($episode) && ! str_contains($episode, '/')) {
779
+                if (!empty($episode) && !str_contains($episode, '/')) {
780 780
                     $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT));
781 781
                 }
782 782
                 // If season is not empty but episode is, add a wildcard to the search
783 783
                 if (empty($episode)) {
784 784
                     $name .= '*';
785 785
                 }
786
-            } elseif (! empty($airDate)) {
786
+            } elseif (!empty($airDate)) {
787 787
                 $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate));
788 788
             }
789 789
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
                 $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit);
792 792
             } else {
793 793
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']);
794
-                if (! empty($searchResult)) {
794
+                if (!empty($searchResult)) {
795 795
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
796 796
                 }
797 797
             }
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
             $query->where('postdate', '>', now()->subDays($maxAge));
808 808
         }
809 809
 
810
-        if (! empty($excludedCategories)) {
810
+        if (!empty($excludedCategories)) {
811 811
             $query->whereNotIn('categories_id', $excludedCategories);
812 812
         }
813 813
 
@@ -852,19 +852,19 @@  discard block
 block discarded – undo
852 852
         $cacheKey = md5(json_encode(func_get_args()));
853 853
         $cacheTTL = now()->addMinutes(config('nntmux.cache_expiry_medium'));
854 854
 
855
-        return Cache::remember($cacheKey, $cacheTTL, function () use ($imDbId, $tmDbId, $traktId, $offset, $limit, $name, $cat, $maxAge, $minSize, $excludedCategories) {
855
+        return Cache::remember($cacheKey, $cacheTTL, function() use ($imDbId, $tmDbId, $traktId, $offset, $limit, $name, $cat, $maxAge, $minSize, $excludedCategories) {
856 856
             $query = self::query()
857 857
                 ->with(['movieinfo', 'group', 'category', 'category.parent', 'nfo'])
858 858
                 ->whereBetween('categories_id', [Category::MOVIE_ROOT, Category::MOVIE_OTHER])
859 859
                 ->where('nzbstatus', NZB::NZB_ADDED)
860 860
                 ->where('passwordstatus', $this->showPasswords());
861 861
 
862
-            if (! empty($name)) {
862
+            if (!empty($name)) {
863 863
                 if (config('nntmux.elasticsearch_enabled') === true) {
864 864
                     $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit);
865 865
                 } else {
866 866
                     $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']);
867
-                    if (! empty($searchResult)) {
867
+                    if (!empty($searchResult)) {
868 868
                         $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
869 869
                     }
870 870
                 }
@@ -877,24 +877,24 @@  discard block
 block discarded – undo
877 877
             }
878 878
 
879 879
             if ($imDbId !== -1 && is_numeric($imDbId)) {
880
-                $query->whereHas('movieinfo', function ($q) use ($imDbId) {
880
+                $query->whereHas('movieinfo', function($q) use ($imDbId) {
881 881
                     $q->where('imdbid', $imDbId);
882 882
                 });
883 883
             }
884 884
 
885 885
             if ($tmDbId !== -1 && is_numeric($tmDbId)) {
886
-                $query->whereHas('movieinfo', function ($q) use ($tmDbId) {
886
+                $query->whereHas('movieinfo', function($q) use ($tmDbId) {
887 887
                     $q->where('tmdbid', $tmDbId);
888 888
                 });
889 889
             }
890 890
 
891 891
             if ($traktId !== -1 && is_numeric($traktId)) {
892
-                $query->whereHas('movieinfo', function ($q) use ($traktId) {
892
+                $query->whereHas('movieinfo', function($q) use ($traktId) {
893 893
                     $q->where('traktid', $traktId);
894 894
                 });
895 895
             }
896 896
 
897
-            if (! empty($excludedCategories)) {
897
+            if (!empty($excludedCategories)) {
898 898
                 $query->whereNotIn('categories_id', $excludedCategories);
899 899
             }
900 900
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
             }
940 940
 
941 941
             $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]);
942
-            if (! $results) {
942
+            if (!$results) {
943 943
                 return $ret;
944 944
             }
945 945
 
Please login to merge, or discard this patch.
app/Http/Controllers/Api/XML_Response.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
             $this->xml->startElement('category');
247 247
             $this->xml->writeAttribute('id', $this->parameters['id']);
248 248
             $this->xml->writeAttribute('name', html_entity_decode($this->parameters['title']));
249
-            if (! empty($this->parameters['description'])) {
249
+            if (!empty($this->parameters['description'])) {
250 250
                 $this->xml->writeAttribute('description', html_entity_decode($this->parameters['description']));
251 251
             }
252 252
             foreach ($this->parameters['categories'] as $c) {
253 253
                 $this->xml->startElement('subcat');
254 254
                 $this->xml->writeAttribute('id', $c['id']);
255 255
                 $this->xml->writeAttribute('name', html_entity_decode($c['title']));
256
-                if (! empty($c['description'])) {
256
+                if (!empty($c['description'])) {
257 257
                     $this->xml->writeAttribute('description', html_entity_decode($c['description']));
258 258
                 }
259 259
                 $this->xml->endElement();
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
         $this->xml->writeAttribute('apimax', $this->parameters['apilimit']);
355 355
         $this->xml->writeAttribute('grabcurrent', $this->parameters['grabs']);
356 356
         $this->xml->writeAttribute('grabmax', $this->parameters['downloadlimit']);
357
-        if (! empty($this->parameters['oldestapi'])) {
357
+        if (!empty($this->parameters['oldestapi'])) {
358 358
             $this->xml->writeAttribute('apioldesttime', $this->parameters['oldestapi']);
359 359
         }
360
-        if (! empty($this->parameters['oldestgrab'])) {
360
+        if (!empty($this->parameters['oldestgrab'])) {
361 361
             $this->xml->writeAttribute('graboldesttime', $this->parameters['oldestgrab']);
362 362
         }
363 363
         $this->xml->endElement();
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
      */
369 369
     public function includeReleases(): void
370 370
     {
371
-        if (! empty($this->releases)) {
372
-            if (! $this->releases instanceof Release) {
371
+        if (!empty($this->releases)) {
372
+            if (!$this->releases instanceof Release) {
373 373
                 foreach ($this->releases as $this->release) {
374 374
                     $this->xml->startElement('item');
375 375
                     $this->includeReleaseMain();
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
         } else {
411 411
             $this->writeRssCdata();
412 412
         }
413
-        if (! isset($this->parameters['dl']) || (isset($this->parameters['dl']) && (int) $this->parameters['dl'] === 1)) {
413
+        if (!isset($this->parameters['dl']) || (isset($this->parameters['dl']) && (int) $this->parameters['dl'] === 1)) {
414 414
             $this->xml->startElement('enclosure');
415 415
             $this->xml->writeAttribute(
416 416
                 'url',
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
     {
432 432
         $this->writeZedAttr('category', $this->release->categories_id);
433 433
         $this->writeZedAttr('size', $this->release->size);
434
-        if (! empty($this->release->coverurl)) {
434
+        if (!empty($this->release->coverurl)) {
435 435
             $this->writeZedAttr(
436 436
                 'coverurl',
437 437
                 $this->server['server']['url']."/covers/{$this->release->coverurl}"
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
             $this->writeZedAttr('comments', $this->release->comments);
467 467
             $this->writeZedAttr('password', $this->release->passwordstatus);
468 468
             $this->writeZedAttr('usenetdate', Carbon::parse($this->release->postdate)->toRssString());
469
-            if (! empty($this->release->group->name)) {
469
+            if (!empty($this->release->group->name)) {
470 470
                 $this->writeZedAttr('group', $this->release->group->name);
471 471
             }
472 472
         }
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
      */
478 478
     protected function setTvAttr(): void
479 479
     {
480
-        if (! empty($this->release->title)) {
480
+        if (!empty($this->release->title)) {
481 481
             $this->writeZedAttr('title', $this->release->title);
482 482
         }
483 483
         if (isset($this->release->series) && $this->release->series > 0) {
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
         if (isset($this->release->episode->episode) && $this->release->episode->episode > 0) {
487 487
             $this->writeZedAttr('episode', $this->release->episode->episode);
488 488
         }
489
-        if (! empty($this->release->firstaired)) {
489
+        if (!empty($this->release->firstaired)) {
490 490
             $this->writeZedAttr('tvairdate', $this->release->firstaired);
491 491
         }
492 492
         if (isset($this->release->video->tvdb) && $this->release->video->tvdb > 0) {
@@ -532,19 +532,19 @@  discard block
 block discarded – undo
532 532
     {
533 533
         $this->cdata = "\n\t<div>\n";
534 534
         switch (1) {
535
-            case ! empty($this->release->cover):
535
+            case !empty($this->release->cover):
536 536
                 $dir = 'movies';
537 537
                 $column = 'imdbid';
538 538
                 break;
539
-            case ! empty($this->release->mu_cover):
539
+            case !empty($this->release->mu_cover):
540 540
                 $dir = 'music';
541 541
                 $column = 'musicinfo_id';
542 542
                 break;
543
-            case ! empty($this->release->co_cover):
543
+            case !empty($this->release->co_cover):
544 544
                 $dir = 'console';
545 545
                 $column = 'consoleinfo_id';
546 546
                 break;
547
-            case ! empty($this->release->bo_cover):
547
+            case !empty($this->release->bo_cover):
548 548
                 $dir = 'books';
549 549
                 $column = 'bookinfo_id';
550 550
                 break;
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
         $cData = '';
681 681
 
682 682
         foreach ($columns as $info) {
683
-            if (! empty($this->release->$info)) {
683
+            if (!empty($this->release->$info)) {
684 684
                 if ($info === 'mu_releasedate') {
685 685
                     $ucInfo = 'Released';
686 686
                     $rDate = date('Y-m-d', strtotime($this->release->$info));
Please login to merge, or discard this patch.