Passed
Push — master ( 98093b...c84873 )
by Darko
15:04 queued 05:00
created
app/Services/TvProcessing/Providers/AbstractTvProvider.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -19,33 +19,33 @@  discard block
 block discarded – undo
19 19
 abstract class AbstractTvProvider extends BaseVideoProvider
20 20
 {
21 21
     // Television Sources
22
-    protected const SOURCE_NONE = 0;   // No Scrape source
22
+    protected const SOURCE_NONE = 0; // No Scrape source
23 23
 
24
-    protected const SOURCE_TVDB = 1;   // Scrape source was TVDB
24
+    protected const SOURCE_TVDB = 1; // Scrape source was TVDB
25 25
 
26
-    protected const SOURCE_TVMAZE = 2;   // Scrape source was TVMAZE
26
+    protected const SOURCE_TVMAZE = 2; // Scrape source was TVMAZE
27 27
 
28
-    protected const SOURCE_TMDB = 3;   // Scrape source was TMDB
28
+    protected const SOURCE_TMDB = 3; // Scrape source was TMDB
29 29
 
30
-    protected const SOURCE_TRAKT = 4;   // Scrape source was Trakt
30
+    protected const SOURCE_TRAKT = 4; // Scrape source was Trakt
31 31
 
32
-    protected const SOURCE_IMDB = 5;   // Scrape source was IMDB
32
+    protected const SOURCE_IMDB = 5; // Scrape source was IMDB
33 33
 
34 34
     // Anime Sources
35
-    protected const SOURCE_ANIDB = 10;   // Scrape source was AniDB
35
+    protected const SOURCE_ANIDB = 10; // Scrape source was AniDB
36 36
 
37 37
     // Processing signifiers
38
-    protected const PROCESS_TVDB = 0;   // Process TVDB First
38
+    protected const PROCESS_TVDB = 0; // Process TVDB First
39 39
 
40
-    protected const PROCESS_TVMAZE = -1;   // Process TVMaze Second
40
+    protected const PROCESS_TVMAZE = -1; // Process TVMaze Second
41 41
 
42
-    protected const PROCESS_TMDB = -2;   // Process TMDB Third
42
+    protected const PROCESS_TMDB = -2; // Process TMDB Third
43 43
 
44
-    protected const PROCESS_TRAKT = -3;   // Process Trakt Fourth
44
+    protected const PROCESS_TRAKT = -3; // Process Trakt Fourth
45 45
 
46
-    protected const PROCESS_IMDB = -4;   // Process IMDB Fifth
46
+    protected const PROCESS_IMDB = -4; // Process IMDB Fifth
47 47
 
48
-    protected const NO_MATCH_FOUND = -6;   // Failed All Methods
48
+    protected const NO_MATCH_FOUND = -6; // Failed All Methods
49 49
 
50 50
     protected const FAILED_PARSE = -100; // Failed Parsing
51 51
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
                     'localzone' => $show['localzone'],
221 221
                 ]);
222 222
                 // If we have AKAs\aliases, insert those as well
223
-                if (! empty($show['aliases'])) {
223
+                if (!empty($show['aliases'])) {
224 224
                     $this->addAliases($videoId, $show['aliases']);
225 225
                 }
226 226
             }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                 $videoId
285 285
             )
286 286
         );
287
-        if (! empty($show['aliases'])) {
287
+        if (!empty($show['aliases'])) {
288 288
             $this->addAliases($videoId, $show['aliases']);
289 289
         }
290 290
     }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      */
295 295
     public function delete(int $id): mixed
296 296
     {
297
-        return DB::transaction(function () use ($id) {
297
+        return DB::transaction(function() use ($id) {
298 298
             DB::delete(
299 299
                 sprintf(
300 300
                     '
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
     {
344 344
         if ($series > 0 && $episode > 0) {
345 345
             $queryString = sprintf('tve.series = %d AND tve.episode = %d', $series, $episode);
346
-        } elseif (! empty($airdate)) {
346
+        } elseif (!empty($airdate)) {
347 347
             $queryString = sprintf('DATE(tve.firstaired) = %s', escapeString(date('Y-m-d', strtotime($airdate))));
348 348
         } else {
349 349
             return false;
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     {
383 383
         $showInfo['name'] = $this->parseName($relname);
384 384
 
385
-        if (! empty($showInfo['name'])) {
385
+        if (!empty($showInfo['name'])) {
386 386
             // Retrieve the country from the cleaned name
387 387
             $showInfo['country'] = $this->parseCountry($showInfo['name']);
388 388
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             $showInfo += $this->parseSeasonEp($relname);
395 395
 
396 396
             // --- Post-parse correction for daily talk shows misclassified as Season = Year ---
397
-            if (isset($showInfo['season'], $showInfo['episode']) && ! isset($showInfo['airdate'])) {
397
+            if (isset($showInfo['season'], $showInfo['episode']) && !isset($showInfo['airdate'])) {
398 398
                 if (is_numeric($showInfo['season']) && (int) $showInfo['season'] >= 1900 && (int) $showInfo['season'] <= (int) date('Y') + 1) {
399 399
                     if (preg_match('/(?P<year>(19|20)\d{2})[.\-\/](?P<month>\d{2})[.\-\/](?P<day>\d{2})/i', $relname, $dateHits)) {
400 400
                         $year = (int) $dateHits['year'];
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
             }
411 411
 
412 412
             if (isset($showInfo['season'], $showInfo['episode'])) {
413
-                if (! isset($showInfo['airdate'])) {
413
+                if (!isset($showInfo['airdate'])) {
414 414
                     if (preg_match('/[^a-z0-9](?P<year>(19|20)(\d{2}))[^a-z0-9]/i', $relname, $yearMatch)) {
415 415
                         $showInfo['cleanname'] .= ' ('.$yearMatch['year'].')';
416 416
                     }
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
     {
482 482
         return preg_replace_callback(
483 483
             '/\b((?:[A-Za-z]\.){2,}[A-Za-z]?\.?)\b/',
484
-            function ($matches) {
484
+            function($matches) {
485 485
                 return str_replace('.', '', $matches[1]);
486 486
             },
487 487
             $str
@@ -675,13 +675,13 @@  discard block
 block discarded – undo
675 675
         $str = preg_replace('/\s+-\s+.*(wo andere|where others|Arbeiten|Working).*$/i', '', $str);
676 676
 
677 677
         // Clean up trailing hyphens, episode numbers, and other artifacts
678
-        $str = preg_replace('/\s*-\s*$/', '', $str);  // Trailing hyphen
679
-        $str = preg_replace('/\s+\d{1,3}\s*$/', '', $str);  // Trailing episode number
680
-        $str = preg_replace('/\s+-$/', '', $str);  // Another trailing hyphen cleanup
678
+        $str = preg_replace('/\s*-\s*$/', '', $str); // Trailing hyphen
679
+        $str = preg_replace('/\s+\d{1,3}\s*$/', '', $str); // Trailing episode number
680
+        $str = preg_replace('/\s+-$/', '', $str); // Another trailing hyphen cleanup
681 681
 
682 682
         $str = preg_replace('/\s{2,}/', ' ', $str);
683 683
 
684
-        $str = trim($str, '"-');  // Trim quotes and hyphens from both ends
684
+        $str = trim($str, '"-'); // Trim quotes and hyphens from both ends
685 685
 
686 686
         return trim($str);
687 687
     }
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
      */
706 706
     public function checkDate(bool|string|null $date): string
707 707
     {
708
-        if (! empty($date)) {
708
+        if (!empty($date)) {
709 709
             $chk = explode(' ', $date);
710 710
             $chkd = explode('-', $chk[0]);
711 711
             if ($chkd[1] > 12) {
@@ -753,11 +753,11 @@  discard block
 block discarded – undo
753 753
         }
754 754
 
755 755
         foreach ($required as $req) {
756
-            if (! \in_array($type, ['tmdbS', 'tmdbE', 'traktS', 'traktE'], false)) {
757
-                if (! isset($array->$req)) {
756
+            if (!\in_array($type, ['tmdbS', 'tmdbE', 'traktS', 'traktE'], false)) {
757
+                if (!isset($array->$req)) {
758 758
                     return false;
759 759
                 }
760
-            } elseif (! isset($array[$req])) {
760
+            } elseif (!isset($array[$req])) {
761 761
                 return false;
762 762
             }
763 763
         }
Please login to merge, or discard this patch.