Passed
Push — master ( 4c3be3...04f1cf )
by Darko
02:53
created
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.