Passed
Push — master ( e70dbc...34c1d4 )
by Darko
07:23
created
Blacklight/Releases.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 				GROUP BY r.id
276 276
 				ORDER BY %s %s %s",
277 277
             $this->uSQL($userShows, 'videos_id'),
278
-            (! empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''),
278
+            (!empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''),
279 279
             NZB::NZB_ADDED,
280 280
             Category::TV_ROOT,
281 281
             Category::TV_OTHER,
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     {
346 346
         // Delete NZB from disk.
347 347
         $nzbPath = $nzb->NZBPath($identifiers['g']);
348
-        if (! empty($nzbPath)) {
348
+        if (!empty($nzbPath)) {
349 349
             File::delete($nzbPath);
350 350
         }
351 351
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
      */
386 386
     public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId)
387 387
     {
388
-        if (! \is_array($guids) || \count($guids) < 1) {
388
+        if (!\is_array($guids) || \count($guids) < 1) {
389 389
             return false;
390 390
         }
391 391
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
         $sql = '(1=2 ';
410 410
         foreach ($userQuery as $query) {
411 411
             $sql .= sprintf('OR (r.%s = %d', $type, $query->$type);
412
-            if (! empty($query->categories)) {
412
+            if (!empty($query->categories)) {
413 413
                 $catsArr = explode('|', $query->categories);
414 414
                 if (\count($catsArr) > 1) {
415 415
                     $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr));
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
             $orderBy = $this->getBrowseOrder($orderBy);
454 454
         }
455 455
 
456
-        $searchFields = Arr::where($searchArr, static function ($value) {
456
+        $searchFields = Arr::where($searchArr, static function($value) {
457 457
             return $value !== -1;
458 458
         });
459 459
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
             $searchResult = $this->elasticSearch->indexSearch($phrases, $limit);
464 464
         } else {
465 465
             $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', '', [], $searchFields);
466
-            if (! empty($searchResult)) {
466
+            if (!empty($searchResult)) {
467 467
                 $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
468 468
             }
469 469
         }
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
                 $searchResult = $this->elasticSearch->indexSearchApi($searchName, $limit);
555 555
             } else {
556 556
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $searchName, ['searchname']);
557
-                if (! empty($searchResult)) {
557
+                if (!empty($searchResult)) {
558 558
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
559 559
                 }
560 560
             }
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
             ((int) $groupName !== -1 ? sprintf(' AND r.groups_id = %d ', UsenetGroup::getIDByName($groupName)) : ''),
571 571
             $catQuery,
572 572
             (\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''),
573
-            (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
573
+            (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
574 574
             ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '')
575 575
         );
576 576
         $baseSql = sprintf(
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
         if ($releases !== null) {
605 605
             return $releases;
606 606
         }
607
-        if ($searchName !== -1 && ! empty($searchResult)) {
607
+        if ($searchName !== -1 && !empty($searchResult)) {
608 608
             $releases = self::fromQuery($sql);
609 609
         } elseif ($searchName !== -1 && empty($searchResult)) {
610 610
             $releases = collect();
@@ -658,11 +658,11 @@  discard block
 block discarded – undo
658 658
             $show = self::fromQuery($showQry);
659 659
 
660 660
             if ($show->isNotEmpty()) {
661
-                if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') {
661
+                if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') {
662 662
                     $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series;
663
-                } elseif (! empty($episode) && $show[0]->episodes !== '') {
663
+                } elseif (!empty($episode) && $show[0]->episodes !== '') {
664 664
                     $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes);
665
-                } elseif (! empty($series) && empty($episode)) {
665
+                } elseif (!empty($series) && empty($episode)) {
666 666
                     // If $series is set but episode is not, return Season Packs and Episodes
667 667
                     $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series;
668 668
                 }
@@ -676,26 +676,26 @@  discard block
 block discarded – undo
676 676
         }
677 677
 
678 678
         // If $name is set it is a fallback search, add available SxxExx/airdate info to the query
679
-        if (! empty($name) && $showSql === '') {
680
-            if (! empty($series) && (int) $series < 1900) {
679
+        if (!empty($name) && $showSql === '') {
680
+            if (!empty($series) && (int) $series < 1900) {
681 681
                 $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT));
682
-                if (! empty($episode) && ! str_contains($episode, '/')) {
682
+                if (!empty($episode) && !str_contains($episode, '/')) {
683 683
                     $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT));
684 684
                 }
685 685
                 // If season is not empty but episode is, add a wildcard to the search
686 686
                 if (empty($episode)) {
687 687
                     $name .= '*';
688 688
                 }
689
-            } elseif (! empty($airDate)) {
689
+            } elseif (!empty($airDate)) {
690 690
                 $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate));
691 691
             }
692 692
         }
693
-        if (! empty($name)) {
693
+        if (!empty($name)) {
694 694
             if (config('nntmux.elasticsearch_enabled') === true) {
695 695
                 $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit);
696 696
             } else {
697 697
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']);
698
-                if (! empty($searchResult)) {
698
+                if (!empty($searchResult)) {
699 699
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
700 700
                 }
701 701
             }
@@ -711,11 +711,11 @@  discard block
 block discarded – undo
711 711
             NZB::NZB_ADDED,
712 712
             $this->showPasswords(),
713 713
             $showSql,
714
-            (! empty($name) && ! empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '',
714
+            (!empty($name) && !empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '',
715 715
             Category::getCategorySearch($cat),
716 716
             $maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : '',
717 717
             $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '',
718
-            ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : ''
718
+            !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : ''
719 719
         );
720 720
         $baseSql = sprintf(
721 721
             "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,
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
         if ($releases !== null) {
752 752
             return $releases;
753 753
         }
754
-        $releases = ((! empty($name) && ! empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : [];
754
+        $releases = ((!empty($name) && !empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : [];
755 755
         if (count($releases) !== 0 && $releases->isNotEmpty()) {
756 756
             $releases[0]->_totalrows = $this->getPagerCount(
757 757
                 preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql)
@@ -799,11 +799,11 @@  discard block
 block discarded – undo
799 799
 
800 800
             $show = self::fromQuery($showQry);
801 801
             if ($show->isNotEmpty()) {
802
-                if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') {
802
+                if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') {
803 803
                     $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series;
804
-                } elseif (! empty($episode) && $show[0]->episodes !== '') {
804
+                } elseif (!empty($episode) && $show[0]->episodes !== '') {
805 805
                     $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes);
806
-                } elseif (! empty($series) && empty($episode)) {
806
+                } elseif (!empty($series) && empty($episode)) {
807 807
                     // If $series is set but episode is not, return Season Packs and Episodes
808 808
                     $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series;
809 809
                 }
@@ -816,26 +816,26 @@  discard block
 block discarded – undo
816 816
             }
817 817
         }
818 818
         // If $name is set it is a fallback search, add available SxxExx/airdate info to the query
819
-        if (! empty($name) && $showSql === '') {
820
-            if (! empty($series) && (int) $series < 1900) {
819
+        if (!empty($name) && $showSql === '') {
820
+            if (!empty($series) && (int) $series < 1900) {
821 821
                 $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT));
822
-                if (! empty($episode) && ! str_contains($episode, '/')) {
822
+                if (!empty($episode) && !str_contains($episode, '/')) {
823 823
                     $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT));
824 824
                 }
825 825
                 // If season is not empty but episode is, add a wildcard to the search
826 826
                 if (empty($episode)) {
827 827
                     $name .= '*';
828 828
                 }
829
-            } elseif (! empty($airDate)) {
829
+            } elseif (!empty($airDate)) {
830 830
                 $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate));
831 831
             }
832 832
         }
833
-        if (! empty($name)) {
833
+        if (!empty($name)) {
834 834
             if (config('nntmux.elasticsearch_enabled') === true) {
835 835
                 $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit);
836 836
             } else {
837 837
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']);
838
-                if (! empty($searchResult)) {
838
+                if (!empty($searchResult)) {
839 839
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
840 840
                 }
841 841
             }
@@ -851,11 +851,11 @@  discard block
 block discarded – undo
851 851
             NZB::NZB_ADDED,
852 852
             $this->showPasswords(),
853 853
             $showSql,
854
-            (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
854
+            (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
855 855
             Category::getCategorySearch($cat),
856 856
             ($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''),
857 857
             ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''),
858
-            ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : ''
858
+            !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : ''
859 859
         );
860 860
         $baseSql = sprintf(
861 861
             "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.tv_episodes_id, r.haspreview, r.jpgstatus,
@@ -905,12 +905,12 @@  discard block
 block discarded – undo
905 905
      */
906 906
     public function animeSearch($aniDbID, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, array $excludedCategories = []): mixed
907 907
     {
908
-        if (! empty($name)) {
908
+        if (!empty($name)) {
909 909
             if (config('nntmux.elasticsearch_enabled') === true) {
910 910
                 $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit);
911 911
             } else {
912 912
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']);
913
-                if (! empty($searchResult)) {
913
+                if (!empty($searchResult)) {
914 914
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
915 915
                 }
916 916
             }
@@ -927,8 +927,8 @@  discard block
 block discarded – undo
927 927
             $this->showPasswords(),
928 928
             NZB::NZB_ADDED,
929 929
             ($aniDbID > -1 ? sprintf(' AND r.anidbid = %d ', $aniDbID) : ''),
930
-            (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
931
-            ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '',
930
+            (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
931
+            !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '',
932 932
             Category::getCategorySearch($cat),
933 933
             ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '')
934 934
         );
@@ -975,12 +975,12 @@  discard block
 block discarded – undo
975 975
      */
976 976
     public function moviesSearch(int $imDbId = -1, int $tmDbId = -1, int $traktId = -1, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, int $minSize = 0, array $excludedCategories = []): mixed
977 977
     {
978
-        if (! empty($name)) {
978
+        if (!empty($name)) {
979 979
             if (config('nntmux.elasticsearch_enabled') === true) {
980 980
                 $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit);
981 981
             } else {
982 982
                 $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']);
983
-                if (! empty($searchResult)) {
983
+                if (!empty($searchResult)) {
984 984
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
985 985
                 }
986 986
             }
@@ -997,11 +997,11 @@  discard block
 block discarded – undo
997 997
 			%s %s %s %s %s %s %s',
998 998
             NZB::NZB_ADDED,
999 999
             $this->showPasswords(),
1000
-            (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
1000
+            (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
1001 1001
             ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = \'%s\' ', $imDbId) : '',
1002 1002
             ($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '',
1003 1003
             ($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '',
1004
-            ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '',
1004
+            !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '',
1005 1005
             Category::getCategorySearch($cat),
1006 1006
             $maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '',
1007 1007
             $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
             }
1058 1058
 
1059 1059
             $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]);
1060
-            if (! $results) {
1060
+            if (!$results) {
1061 1061
                 return $ret;
1062 1062
             }
1063 1063
 
Please login to merge, or discard this patch.
Blacklight/Movie.php 1 patch
Spacing   +67 added lines, -67 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;
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
             ->where('movieinfo.title', '!=', '')
187 187
             ->where('movieinfo.imdbid', '!=', '0000000')
188 188
             ->when($maxAge > 0, fn ($query) => $query->whereRaw('r.postdate > NOW() - INTERVAL ? DAY', [$maxAge]))
189
-            ->when(! empty($excludedCats), fn ($query) => $query->whereNotIn('r.categories_id', $excludedCats))
190
-            ->when(! empty($categorySearch), fn ($query) => $query->whereRaw(
189
+            ->when(!empty($excludedCats), fn ($query) => $query->whereNotIn('r.categories_id', $excludedCats))
190
+            ->when(!empty($categorySearch), fn ($query) => $query->whereRaw(
191 191
                 // Check if $categorySearch starts with AND or OR and clean it up
192 192
                 preg_match('/^\s*(AND|OR)\s+/i', $categorySearch) ? preg_replace('/^\s*(AND|OR)\s+/i', '', $categorySearch) : $categorySearch
193 193
             ))
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         $movieIDs = $movies->pluck('imdbid')->toArray();
203 203
         $releaseIDs = $movies->pluck('grp_release_id')->toArray();
204 204
 
205
-        if (! empty($movieIDs)) {
205
+        if (!empty($movieIDs)) {
206 206
             $moviesDetailQuery = Release::query()
207 207
                 ->selectRaw('
208 208
                 GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ",") AS grp_release_id,
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
                 ->join('movieinfo as m', 'm.imdbid', '=', 'r.imdbid')
233 233
                 ->whereIn('m.imdbid', $movieIDs)
234 234
                 ->whereIn('r.id', $releaseIDs)
235
-                ->when(! empty($categorySearch), fn ($query) => $query->whereRaw($categorySearch))
235
+                ->when(!empty($categorySearch), fn ($query) => $query->whereRaw($categorySearch))
236 236
                 ->groupBy('m.imdbid')
237 237
                 ->orderBy($order[0], $order[1])
238 238
                 ->get();
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
         $browseBy = ' ';
290 290
         $browseByArr = ['title', 'director', 'actors', 'genre', 'rating', 'year', 'imdb'];
291 291
         foreach ($browseByArr as $bb) {
292
-            if (request()->has($bb) && ! empty(request()->input($bb))) {
292
+            if (request()->has($bb) && !empty(request()->input($bb))) {
293 293
                 $bbv = stripslashes(request()->input($bb));
294 294
                 if ($bb === 'rating') {
295 295
                     $bbv .= '.';
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
         if ($this->traktcheck !== null) {
324 324
             $data = $this->traktTv->client->movieSummary('tt'.$imdbId, 'full');
325
-            if (($data !== false) && ! empty($data['trailer'])) {
325
+            if (($data !== false) && !empty($data['trailer'])) {
326 326
                 return $data['trailer'];
327 327
             }
328 328
         }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             return false;
349 349
         }
350 350
 
351
-        if (! empty($data['trailer'])) {
351
+        if (!empty($data['trailer'])) {
352 352
             $data['trailer'] = str_ireplace(
353 353
                 ['watch?v=', 'http://'],
354 354
                 ['embed/', 'https://'],
@@ -382,17 +382,17 @@  discard block
 block discarded – undo
382 382
      */
383 383
     private function checkTraktValue($value)
384 384
     {
385
-        if (\is_array($value) && ! empty($value)) {
385
+        if (\is_array($value) && !empty($value)) {
386 386
             $temp = '';
387 387
             foreach ($value as $val) {
388
-                if (! \is_array($val) && ! \is_object($val)) {
388
+                if (!\is_array($val) && !\is_object($val)) {
389 389
                     $temp .= $val;
390 390
                 }
391 391
             }
392 392
             $value = $temp;
393 393
         }
394 394
 
395
-        return ! empty($value) ? $value : '';
395
+        return !empty($value) ? $value : '';
396 396
     }
397 397
 
398 398
     /**
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
      */
414 414
     public function update(array $values): bool
415 415
     {
416
-        if (! \count($values)) {
416
+        if (!\count($values)) {
417 417
             return false;
418 418
         }
419 419
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
         $onDuplicateKey = ['created_at' => now()];
422 422
         $found = 0;
423 423
         foreach ($values as $key => $value) {
424
-            if (! empty($value)) {
424
+            if (!empty($value)) {
425 425
                 $found++;
426 426
                 if (\in_array($key, ['genre', 'language'], false)) {
427 427
                     $value = substr($value, 0, 64);
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
                 $onDuplicateKey += [$key => $value];
431 431
             }
432 432
         }
433
-        if (! $found) {
433
+        if (!$found) {
434 434
             return false;
435 435
         }
436 436
         foreach ($query as $key => $value) {
@@ -447,19 +447,19 @@  discard block
 block discarded – undo
447 447
      */
448 448
     protected function setVariables(string|array $variable1, string|array $variable2, string|array $variable3, string|array $variable4, string|array $variable5)
449 449
     {
450
-        if (! empty($variable1)) {
450
+        if (!empty($variable1)) {
451 451
             return $variable1;
452 452
         }
453
-        if (! empty($variable2)) {
453
+        if (!empty($variable2)) {
454 454
             return $variable2;
455 455
         }
456
-        if (! empty($variable3)) {
456
+        if (!empty($variable3)) {
457 457
             return $variable3;
458 458
         }
459
-        if (! empty($variable4)) {
459
+        if (!empty($variable4)) {
460 460
             return $variable4;
461 461
         }
462
-        if (! empty($variable5)) {
462
+        if (!empty($variable5)) {
463 463
             return $variable5;
464 464
         }
465 465
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 
495 495
         $iTunes = $this->fetchItunesMovieProperties($this->currentTitle);
496 496
 
497
-        if (! $imdb && ! $tmdb && ! $trakt && ! $omdb && empty($iTunes)) {
497
+        if (!$imdb && !$tmdb && !$trakt && !$omdb && empty($iTunes)) {
498 498
             return false;
499 499
         }
500 500
 
@@ -507,36 +507,36 @@  discard block
 block discarded – undo
507 507
         $mov['type'] = $mov['director'] = $mov['actors'] = $mov['language'] = '';
508 508
 
509 509
         $mov['imdbid'] = $imdbId;
510
-        $mov['tmdbid'] = (! isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid'];
511
-        $mov['traktid'] = (! isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id'];
510
+        $mov['tmdbid'] = (!isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid'];
511
+        $mov['traktid'] = (!isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id'];
512 512
 
513 513
         // Prefer Fanart.tv cover over TMDB,TMDB over IMDB,IMDB over OMDB and OMDB over iTunes.
514
-        if (! empty($fanart['cover'])) {
514
+        if (!empty($fanart['cover'])) {
515 515
             $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $fanart['cover'], $this->imgSavePath);
516
-        } elseif (! empty($tmdb['cover'])) {
516
+        } elseif (!empty($tmdb['cover'])) {
517 517
             $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $tmdb['cover'], $this->imgSavePath);
518
-        } elseif (! empty($imdb['cover'])) {
518
+        } elseif (!empty($imdb['cover'])) {
519 519
             $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $imdb['cover'], $this->imgSavePath);
520
-        } elseif (! empty($omdb['cover'])) {
520
+        } elseif (!empty($omdb['cover'])) {
521 521
             $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $omdb['cover'], $this->imgSavePath);
522
-        } elseif (! empty($iTunes['cover'])) {
522
+        } elseif (!empty($iTunes['cover'])) {
523 523
             $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $iTunes['cover'], $this->imgSavePath);
524 524
         }
525 525
 
526 526
         // Backdrops.
527
-        if (! empty($fanart['backdrop'])) {
527
+        if (!empty($fanart['backdrop'])) {
528 528
             $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $fanart['backdrop'], $this->imgSavePath, 1920, 1024);
529
-        } elseif (! empty($tmdb['backdrop'])) {
529
+        } elseif (!empty($tmdb['backdrop'])) {
530 530
             $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024);
531 531
         }
532 532
 
533 533
         // Banner
534
-        if (! empty($fanart['banner'])) {
534
+        if (!empty($fanart['banner'])) {
535 535
             $mov['banner'] = $this->releaseImage->saveImage($imdbId.'-banner', $fanart['banner'], $this->imgSavePath);
536 536
         }
537 537
 
538 538
         // RottenTomatoes rating from OmdbAPI
539
-        if ($omdb !== false && ! empty($omdb['rtRating'])) {
539
+        if ($omdb !== false && !empty($omdb['rtRating'])) {
540 540
             $mov['rtrating'] = $omdb['rtRating'];
541 541
         }
542 542
 
@@ -547,29 +547,29 @@  discard block
 block discarded – undo
547 547
         $mov['year'] = $this->setVariables($imdb['year'] ?? '', $tmdb['year'] ?? '', $trakt['year'] ?? '', $omdb['year'] ?? '', $iTunes['year'] ?? '');
548 548
         $mov['genre'] = $this->setVariables($imdb['genre'] ?? '', $tmdb['genre'] ?? '', $trakt['genres'] ?? '', $omdb['genre'] ?? '', $iTunes['genre'] ?? '');
549 549
 
550
-        if (! empty($imdb['type'])) {
550
+        if (!empty($imdb['type'])) {
551 551
             $mov['type'] = $imdb['type'];
552 552
         }
553 553
 
554
-        if (! empty($imdb['director'])) {
554
+        if (!empty($imdb['director'])) {
555 555
             $mov['director'] = \is_array($imdb['director']) ? implode(', ', array_unique($imdb['director'])) : $imdb['director'];
556
-        } elseif (! empty($omdb['director'])) {
556
+        } elseif (!empty($omdb['director'])) {
557 557
             $mov['director'] = \is_array($omdb['director']) ? implode(', ', array_unique($omdb['director'])) : $omdb['director'];
558
-        } elseif (! empty($tmdb['director'])) {
558
+        } elseif (!empty($tmdb['director'])) {
559 559
             $mov['director'] = \is_array($tmdb['director']) ? implode(', ', array_unique($tmdb['director'])) : $tmdb['director'];
560 560
         }
561 561
 
562
-        if (! empty($imdb['actors'])) {
562
+        if (!empty($imdb['actors'])) {
563 563
             $mov['actors'] = \is_array($imdb['actors']) ? implode(', ', array_unique($imdb['actors'])) : $imdb['actors'];
564
-        } elseif (! empty($omdb['actors'])) {
564
+        } elseif (!empty($omdb['actors'])) {
565 565
             $mov['actors'] = \is_array($omdb['actors']) ? implode(', ', array_unique($omdb['actors'])) : $omdb['actors'];
566
-        } elseif (! empty($tmdb['actors'])) {
566
+        } elseif (!empty($tmdb['actors'])) {
567 567
             $mov['actors'] = \is_array($tmdb['actors']) ? implode(', ', array_unique($tmdb['actors'])) : $tmdb['actors'];
568 568
         }
569 569
 
570
-        if (! empty($imdb['language'])) {
570
+        if (!empty($imdb['language'])) {
571 571
             $mov['language'] = \is_array($imdb['language']) ? implode(', ', array_unique($imdb['language'])) : $imdb['language'];
572
-        } elseif (! empty($omdb['language']) && ! is_bool($omdb['language'])) {
572
+        } elseif (!empty($omdb['language']) && !is_bool($omdb['language'])) {
573 573
             $mov['language'] = \is_array($omdb['language']) ? implode(', ', array_unique($omdb['language'])) : $omdb['language'];
574 574
         }
575 575
 
@@ -627,20 +627,20 @@  discard block
 block discarded – undo
627 627
         if ($this->fanartapikey !== null) {
628 628
             $art = $this->fanart->getMovieFanArt('tt'.$imdbId);
629 629
 
630
-            if (! empty($art)) {
630
+            if (!empty($art)) {
631 631
                 if (isset($art['status']) && $art['status'] === 'error') {
632 632
                     return false;
633 633
                 }
634 634
                 $ret = [];
635
-                if (! empty($art['moviebackground'][0]['url'])) {
635
+                if (!empty($art['moviebackground'][0]['url'])) {
636 636
                     $ret['backdrop'] = $art['moviebackground'][0]['url'];
637
-                } elseif (! empty($art['moviethumb'][0]['url'])) {
637
+                } elseif (!empty($art['moviethumb'][0]['url'])) {
638 638
                     $ret['backdrop'] = $art['moviethumb'][0]['url'];
639 639
                 }
640
-                if (! empty($art['movieposter'][0]['url'])) {
640
+                if (!empty($art['movieposter'][0]['url'])) {
641 641
                     $ret['cover'] = $art['movieposter'][0]['url'];
642 642
                 }
643
-                if (! empty($art['moviebanner'][0]['url'])) {
643
+                if (!empty($art['moviebanner'][0]['url'])) {
644 644
                     $ret['banner'] = $art['moviebanner'][0]['url'];
645 645
                 }
646 646
 
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
             return false;
678 678
         }
679 679
 
680
-        if (! empty($tmdbLookup)) {
680
+        if (!empty($tmdbLookup)) {
681 681
             if ($this->currentTitle !== '') {
682 682
                 // Check the similarity.
683 683
                 similar_text($this->currentTitle, $tmdbLookup['title'], $percent);
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
                 $ret['rating'] = '';
707 707
             }
708 708
             $actors = Arr::pluck($tmdbLookup['credits']['cast'], 'name');
709
-            if (! empty($actors)) {
709
+            if (!empty($actors)) {
710 710
                 $ret['actors'] = $actors;
711 711
             } else {
712 712
                 $ret['actors'] = '';
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
                 }
718 718
             }
719 719
             $overview = $tmdbLookup['overview'];
720
-            if (! empty($overview)) {
720
+            if (!empty($overview)) {
721 721
                 $ret['plot'] = $overview;
722 722
             } else {
723 723
                 $ret['plot'] = '';
@@ -727,13 +727,13 @@  discard block
 block discarded – undo
727 727
             $ret['tagline'] = $tagline ?? '';
728 728
 
729 729
             $released = $tmdbLookup['release_date'];
730
-            if (! empty($released)) {
730
+            if (!empty($released)) {
731 731
                 $ret['year'] = Carbon::parse($released)->year;
732 732
             } else {
733 733
                 $ret['year'] = '';
734 734
             }
735 735
             $genresa = $tmdbLookup['genres'];
736
-            if (! empty($genresa) && \count($genresa) > 0) {
736
+            if (!empty($genresa) && \count($genresa) > 0) {
737 737
                 $genres = [];
738 738
                 foreach ($genresa as $genre) {
739 739
                     $genres[] = $genre['name'];
@@ -743,13 +743,13 @@  discard block
 block discarded – undo
743 743
                 $ret['genre'] = '';
744 744
             }
745 745
             $posterp = $tmdbLookup['poster_path'];
746
-            if (! empty($posterp)) {
746
+            if (!empty($posterp)) {
747 747
                 $ret['cover'] = 'https://image.tmdb.org/t/p/original'.$posterp;
748 748
             } else {
749 749
                 $ret['cover'] = '';
750 750
             }
751 751
             $backdrop = $tmdbLookup['backdrop_path'];
752
-            if (! empty($backdrop)) {
752
+            if (!empty($backdrop)) {
753 753
                 $ret['backdrop'] = 'https://image.tmdb.org/t/p/original'.$backdrop;
754 754
             } else {
755 755
                 $ret['backdrop'] = '';
@@ -771,9 +771,9 @@  discard block
 block discarded – undo
771 771
     {
772 772
         $realId = (new Title($imdbId, $this->config))->real_id();
773 773
         $result = new Title($realId, $this->config);
774
-        $title = ! empty($result->orig_title()) ? $result->orig_title() : $result->title();
775
-        if (! empty($title)) {
776
-            if (! empty($this->currentTitle)) {
774
+        $title = !empty($result->orig_title()) ? $result->orig_title() : $result->title();
775
+        if (!empty($title)) {
776
+            if (!empty($this->currentTitle)) {
777 777
                 similar_text($this->currentTitle, $title, $percent);
778 778
                 if ($percent >= self::MATCH_PERCENT) {
779 779
                     similar_text($this->currentYear, $result->year(), $percent);
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
                             'title' => $title,
783 783
                             'tagline' => $result->tagline() ?? '',
784 784
                             'plot' => Arr::get($result->plot_split(), '0.plot'),
785
-                            'rating' => ! empty($result->rating()) ? $result->rating() : '',
785
+                            'rating' => !empty($result->rating()) ? $result->rating() : '',
786 786
                             'year' => $result->year() ?? '',
787 787
                             'cover' => $result->photo() ?? '',
788 788
                             'genre' => $result->genre() ?? '',
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
                 'title' => $title,
808 808
                 'tagline' => $result->tagline() ?? '',
809 809
                 'plot' => Arr::get($result->plot_split(), '0.plot'),
810
-                'rating' => ! empty($result->rating()) ? $result->rating() : '',
810
+                'rating' => !empty($result->rating()) ? $result->rating() : '',
811 811
                 'year' => $result->year() ?? '',
812 812
                 'cover' => $result->photo() ?? '',
813 813
                 'genre' => $result->genre() ?? '',
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
         if ($this->omdbapikey !== null) {
882 882
             $resp = $this->omdbApi->fetch('i', 'tt'.$imdbId);
883 883
 
884
-            if (\is_object($resp) && $resp->message === 'OK' && ! Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') {
884
+            if (\is_object($resp) && $resp->message === 'OK' && !Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') {
885 885
                 similar_text($this->currentTitle, $resp->data->Title, $percent);
886 886
                 if ($percent >= self::MATCH_PERCENT) {
887 887
                     similar_text($this->currentYear, $resp->data->Year, $percent);
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
             // Loop over releases.
1048 1048
             foreach ($res as $arr) {
1049 1049
                 // Try to get a name/year.
1050
-                if (! $this->parseMovieSearchName($arr['searchname'])) {
1050
+                if (!$this->parseMovieSearchName($arr['searchname'])) {
1051 1051
                     //We didn't find a name, so set to all 0's so we don't parse again.
1052 1052
                     Release::query()->where('id', $arr['id'])->update(['imdbid' => 0000000]);
1053 1053
 
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
                     try {
1082 1082
                         $imdbSearch = new TitleSearch($this->config);
1083 1083
                         foreach ($imdbSearch->search($this->currentTitle, [TitleSearch::MOVIE]) as $imdbTitle) {
1084
-                            if (! empty($imdbTitle->title())) {
1084
+                            if (!empty($imdbTitle->title())) {
1085 1085
                                 similar_text($imdbTitle->title(), $this->currentTitle, $percent);
1086 1086
                                 if ($percent >= self::MATCH_PERCENT) {
1087 1087
                                     similar_text($this->currentYear, $imdbTitle->year(), $percent);
@@ -1111,10 +1111,10 @@  discard block
 block discarded – undo
1111 1111
                             $buffer = $this->omdbApi->search($omdbTitle, 'movie');
1112 1112
                         }
1113 1113
 
1114
-                        if (\is_object($buffer) && $buffer->message === 'OK' && ! Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') {
1114
+                        if (\is_object($buffer) && $buffer->message === 'OK' && !Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') {
1115 1115
                             $getIMDBid = $buffer->data->Search[0]->imdbID;
1116 1116
 
1117
-                            if (! empty($getIMDBid)) {
1117
+                            if (!empty($getIMDBid)) {
1118 1118
                                 $imdbId = $this->doMovieUpdate($getIMDBid, 'OMDbAPI', $arr['id']);
1119 1119
                                 if ($imdbId !== false) {
1120 1120
                                     $movieUpdated = true;
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
                     $data = $this->traktTv->client->movieSummary($movieName, 'full');
1130 1130
                     if ($data !== false) {
1131 1131
                         $this->parseTraktTv($data);
1132
-                        if (! empty($data['ids']['imdb'])) {
1132
+                        if (!empty($data['ids']['imdb'])) {
1133 1133
                             $imdbId = $this->doMovieUpdate($data['ids']['imdb'], 'Trakt', $arr['id']);
1134 1134
                             if ($imdbId !== false) {
1135 1135
                                 $movieUpdated = true;
@@ -1142,13 +1142,13 @@  discard block
 block discarded – undo
1142 1142
                 if ($movieUpdated === false) {
1143 1143
                     try {
1144 1144
                         $data = Tmdb::getSearchApi()->searchMovies($this->currentTitle);
1145
-                        if (($data['total_results'] > 0) && ! empty($data['results'])) {
1145
+                        if (($data['total_results'] > 0) && !empty($data['results'])) {
1146 1146
                             foreach ($data['results'] as $result) {
1147
-                                if (! empty($result['id']) && ! empty($result['release_date'])) {
1147
+                                if (!empty($result['id']) && !empty($result['release_date'])) {
1148 1148
                                     similar_text($this->currentYear, Carbon::parse($result['release_date'])->year, $percent);
1149 1149
                                     if ($percent >= self::YEAR_MATCH_PERCENT) {
1150 1150
                                         $ret = $this->fetchTMDBProperties($result['id'], true);
1151
-                                        if ($ret !== false && ! empty($ret['imdbid'])) {
1151
+                                        if ($ret !== false && !empty($ret['imdbid'])) {
1152 1152
                                             $imdbId = $this->doMovieUpdate('tt'.$ret['imdbid'], 'TMDB', $arr['id']);
1153 1153
                                             if ($imdbId !== false) {
1154 1154
                                                 $movieUpdated = true;
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
             // Finally remove multiple spaces and trim leading spaces.
1250 1250
             $name = trim(preg_replace('/\s{2,}/', ' ', $name));
1251 1251
             // Check if the name is long enough and not just numbers.
1252
-            if (\strlen($name) > 4 && ! preg_match('/^\d+$/', $name)) {
1252
+            if (\strlen($name) > 4 && !preg_match('/^\d+$/', $name)) {
1253 1253
                 $this->currentTitle = $name;
1254 1254
                 $this->currentYear = $year;
1255 1255
 
Please login to merge, or discard this patch.