Passed
Push — master ( 14af2f...574fad )
by Darko
10:47
created
app/Services/TvProcessing/Providers/TmdbProvider.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
                         $seriesNo = preg_replace('/^S0*/i', '', $release['season']);
122 122
                         $episodeNo = preg_replace('/^E0*/i', '', $release['episode']);
123
-                        $hasAirdate = ! empty($release['airdate']);
123
+                        $hasAirdate = !empty($release['airdate']);
124 124
 
125 125
                         if ($episodeNo === 'all') {
126 126
                             // Set the video ID and leave episode 0
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
         $this->tmdbClient = app(TmdbClient::class);
260 260
 
261
-        if (! $this->tmdbClient->isConfigured()) {
261
+        if (!$this->tmdbClient->isConfigured()) {
262 262
             return false;
263 263
         }
264 264
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
         sleep(1);
268 268
 
269
-        if ($response !== null && ! empty($response['results']) && is_array($response['results'])) {
269
+        if ($response !== null && !empty($response['results']) && is_array($response['results'])) {
270 270
             $return = $this->matchShowInfo($response['results'], $name);
271 271
         }
272 272
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         $highest = null;
284 284
 
285 285
         foreach ($shows as $show) {
286
-            if (! is_array($show) || ! $this->checkRequiredAttr($show, 'tmdbS')) {
286
+            if (!is_array($show) || !$this->checkRequiredAttr($show, 'tmdbS')) {
287 287
                 continue;
288 288
             }
289 289
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
             // Use available network info if present
334 334
             $networks = TmdbClient::getArray($highest, 'networks');
335
-            $highest['network'] = ! empty($networks[0]['name']) ? $networks[0]['name'] : '';
335
+            $highest['network'] = !empty($networks[0]['name']) ? $networks[0]['name'] : '';
336 336
 
337 337
             $highest['external_ids'] = $showExternalIds;
338 338
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         $hascover = 0;
355 355
 
356 356
         // Try to get the Poster
357
-        if (! empty($this->posterUrl)) {
357
+        if (!empty($this->posterUrl)) {
358 358
             $hascover = $ri->saveImage($videoId, $this->posterUrl, $this->imgSavePath);
359 359
 
360 360
             // Mark it retrieved if we saved an image
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
     {
400 400
         $return = false;
401 401
 
402
-        if (! isset($this->tmdbClient)) {
402
+        if (!isset($this->tmdbClient)) {
403 403
             $this->tmdbClient = app(TmdbClient::class);
404 404
         }
405 405
 
406
-        if (! $this->tmdbClient->isConfigured()) {
406
+        if (!$this->tmdbClient->isConfigured()) {
407 407
             return false;
408 408
         }
409 409
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
             }
422 422
 
423 423
             foreach ($seasons as $seriesInfo) {
424
-                if (! is_array($seriesInfo)) {
424
+                if (!is_array($seriesInfo)) {
425 425
                     continue;
426 426
                 }
427 427
 
@@ -478,19 +478,19 @@  discard block
 block discarded – undo
478 478
      */
479 479
     public function formatShowInfo($show): array
480 480
     {
481
-        if (! is_array($show)) {
481
+        if (!is_array($show)) {
482 482
             return [];
483 483
         }
484 484
 
485 485
         $posterPath = TmdbClient::getString($show, 'poster_path');
486 486
         // Prefer a reasonable default size for posters if we only have a path
487
-        $this->posterUrl = ! empty($posterPath)
487
+        $this->posterUrl = !empty($posterPath)
488 488
             ? 'https://image.tmdb.org/t/p/w500'.$posterPath
489 489
             : '';
490 490
 
491 491
         $imdbId = 0;
492 492
         $externalIds = TmdbClient::getArray($show, 'external_ids');
493
-        if (! empty($externalIds['imdb_id'])) {
493
+        if (!empty($externalIds['imdb_id'])) {
494 494
             preg_match('/tt(?P<imdbid>\d{6,7})$/i', $externalIds['imdb_id'], $imdb);
495 495
             $imdbId = $imdb['imdbid'] ?? 0;
496 496
         }
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
             'summary' => TmdbClient::getString($show, 'overview'),
512 512
             'started' => TmdbClient::getString($show, 'first_air_date'),
513 513
             'publisher' => TmdbClient::getString($show, 'network'),
514
-            'country' => ! empty($originCountry[0]) ? $originCountry[0] : '',
514
+            'country' => !empty($originCountry[0]) ? $originCountry[0] : '',
515 515
             'source' => parent::SOURCE_TMDB,
516 516
             'imdb' => $imdbId,
517 517
             'tvdb' => TmdbClient::getInt($externalIds, 'tvdb_id'),
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
             'tvrage' => TmdbClient::getInt($externalIds, 'tvrage_id'),
520 520
             'tvmaze' => 0,
521 521
             'tmdb' => $tmdbId,
522
-            'aliases' => ! empty($alternativeTitles) ? $alternativeTitles : '',
522
+            'aliases' => !empty($alternativeTitles) ? $alternativeTitles : '',
523 523
             'localzone' => "''",
524 524
         ];
525 525
     }
@@ -538,22 +538,22 @@  discard block
 block discarded – undo
538 538
         try {
539 539
             $traktService = app(\App\Services\TraktService::class);
540 540
 
541
-            if (! $traktService->isConfigured()) {
541
+            if (!$traktService->isConfigured()) {
542 542
                 return 0;
543 543
             }
544 544
 
545 545
             // Try TMDB ID first
546 546
             if ($tmdbId > 0) {
547 547
                 $ids = $traktService->lookupShowIds($tmdbId, 'tmdb');
548
-                if ($ids !== null && ! empty($ids['trakt'])) {
548
+                if ($ids !== null && !empty($ids['trakt'])) {
549 549
                     return (int) $ids['trakt'];
550 550
                 }
551 551
             }
552 552
 
553 553
             // Try IMDB ID
554
-            if (! empty($imdbId) && $imdbId > 0) {
554
+            if (!empty($imdbId) && $imdbId > 0) {
555 555
                 $ids = $traktService->lookupShowIds($imdbId, 'imdb');
556
-                if ($ids !== null && ! empty($ids['trakt'])) {
556
+                if ($ids !== null && !empty($ids['trakt'])) {
557 557
                     return (int) $ids['trakt'];
558 558
                 }
559 559
             }
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
             // Try TVDB ID
562 562
             if ($tvdbId > 0) {
563 563
                 $ids = $traktService->lookupShowIds($tvdbId, 'tvdb');
564
-                if ($ids !== null && ! empty($ids['trakt'])) {
564
+                if ($ids !== null && !empty($ids['trakt'])) {
565 565
                     return (int) $ids['trakt'];
566 566
                 }
567 567
             }
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
      */
579 579
     public function formatEpisodeInfo($episode): array
580 580
     {
581
-        if (! is_array($episode)) {
581
+        if (!is_array($episode)) {
582 582
             return [];
583 583
         }
584 584
 
Please login to merge, or discard this patch.
app/Services/TvProcessing/Providers/TraktProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 
350 350
         if (\is_array($response)) {
351 351
             foreach ($response as $show) {
352
-                if (! is_bool($show)) {
352
+                if (!is_bool($show)) {
353 353
                     // Check for exact title match first and then terminate if found
354 354
                     if ($show['show']['title'] === $name) {
355 355
                         $highest = $show;
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
             'tvrage' => $show['ids']['tvrage'] ?? 0,
409 409
             'tvmaze' => $tvmazeId,
410 410
             'tmdb' => $show['ids']['tmdb'] ?? 0,
411
-            'aliases' => isset($show['aliases']) && ! empty($show['aliases']) ? $show['aliases'] : '',
411
+            'aliases' => isset($show['aliases']) && !empty($show['aliases']) ? $show['aliases'] : '',
412 412
             'localzone' => $this->localizedTZ,
413 413
         ];
414 414
     }
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
             }
435 435
 
436 436
             // Try IMDB ID as fallback
437
-            if (! empty($imdbId) && $imdbId > 0) {
438
-                $imdbFormatted = 'tt' . str_pad((string) $imdbId, 7, '0', STR_PAD_LEFT);
437
+            if (!empty($imdbId) && $imdbId > 0) {
438
+                $imdbFormatted = 'tt'.str_pad((string) $imdbId, 7, '0', STR_PAD_LEFT);
439 439
                 $result = $tvmazeClient->getShowBySiteID('imdb', $imdbFormatted);
440 440
                 if ($result !== null && isset($result->id)) {
441 441
                     return (int) $result->id;
Please login to merge, or discard this patch.
app/Services/TvProcessing/Providers/TvMazeProvider.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
                 }
330 330
 
331 331
                 // Alias matches
332
-                if (is_array($show->akas) && ! empty($show->akas)) {
332
+                if (is_array($show->akas) && !empty($show->akas)) {
333 333
                     foreach ($show->akas as $aka) {
334
-                        if (! isset($aka['name'])) {
334
+                        if (!isset($aka['name'])) {
335 335
                             continue;
336 336
                         }
337 337
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         $hasCover = 0;
373 373
 
374 374
         // Try to get the Poster
375
-        if (! empty($this->posterUrl)) {
375
+        if (!empty($this->posterUrl)) {
376 376
             $hasCover = $ri->saveImage($videoId, $this->posterUrl, $this->imgSavePath);
377 377
 
378 378
             // Mark it retrieved if we saved an image
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         $imdbId = 0;
434 434
 
435 435
         // Extract IMDB ID if available
436
-        if (! empty($show->externalIDs['imdb'])) {
436
+        if (!empty($show->externalIDs['imdb'])) {
437 437
             preg_match('/tt(?P<imdbid>\d{6,9})$/i', $show->externalIDs['imdb'], $imdb);
438 438
             $imdbId = (int) ($imdb['imdbid'] ?? 0);
439 439
         }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
             'trakt' => $externalIds['trakt'],
456 456
             'tvrage' => (int) ($show->externalIDs['tvrage'] ?? 0),
457 457
             'tmdb' => $externalIds['tmdb'],
458
-            'aliases' => ! empty($show->akas) ? (array) $show->akas : '',
458
+            'aliases' => !empty($show->akas) ? (array) $show->akas : '',
459 459
             'localzone' => "''",
460 460
         ];
461 461
     }
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
                     }
484 484
                 }
485 485
                 // Try IMDB ID if TMDB not found
486
-                if ($result['tmdb'] === 0 && ! empty($imdbId) && $imdbId > 0) {
486
+                if ($result['tmdb'] === 0 && !empty($imdbId) && $imdbId > 0) {
487 487
                     $tmdbIds = $tmdbClient->lookupTvShowIds($imdbId, 'imdb');
488 488
                     if ($tmdbIds !== null) {
489 489
                         $result['tmdb'] = $tmdbIds['tmdb'] ?? 0;
@@ -497,10 +497,10 @@  discard block
 block discarded – undo
497 497
                 // Try TVDB ID first
498 498
                 if ($tvdbId > 0) {
499 499
                     $traktIds = $traktService->lookupShowIds($tvdbId, 'tvdb');
500
-                    if ($traktIds !== null && ! empty($traktIds['trakt'])) {
500
+                    if ($traktIds !== null && !empty($traktIds['trakt'])) {
501 501
                         $result['trakt'] = (int) $traktIds['trakt'];
502 502
                         // Also get TMDB if we didn't find it above
503
-                        if ($result['tmdb'] === 0 && ! empty($traktIds['tmdb'])) {
503
+                        if ($result['tmdb'] === 0 && !empty($traktIds['tmdb'])) {
504 504
                             $result['tmdb'] = (int) $traktIds['tmdb'];
505 505
                         }
506 506
                         return $result;
@@ -508,11 +508,11 @@  discard block
 block discarded – undo
508 508
                 }
509 509
 
510 510
                 // Try IMDB ID as fallback
511
-                if (! empty($imdbId) && $imdbId > 0) {
511
+                if (!empty($imdbId) && $imdbId > 0) {
512 512
                     $traktIds = $traktService->lookupShowIds($imdbId, 'imdb');
513
-                    if ($traktIds !== null && ! empty($traktIds['trakt'])) {
513
+                    if ($traktIds !== null && !empty($traktIds['trakt'])) {
514 514
                         $result['trakt'] = (int) $traktIds['trakt'];
515
-                        if ($result['tmdb'] === 0 && ! empty($traktIds['tmdb'])) {
515
+                        if ($result['tmdb'] === 0 && !empty($traktIds['tmdb'])) {
516 516
                             $result['tmdb'] = (int) $traktIds['tmdb'];
517 517
                         }
518 518
                     }
Please login to merge, or discard this patch.
app/Services/TvProcessing/Providers/TvdbProvider.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -132,19 +132,19 @@  discard block
 block discarded – undo
132 132
                 }
133 133
 
134 134
                 if ((int) $videoId > 0 && (int) $siteId > 0) {
135
-                    if (! empty($tvdbShow['poster'])) {
135
+                    if (!empty($tvdbShow['poster'])) {
136 136
                         $this->getPoster($videoId);
137 137
                     } elseif ($this->fanart->isConfigured()) {
138 138
                         $posterUrl = $this->fanart->getBestTvPoster($siteId);
139
-                        if (! empty($posterUrl)) {
139
+                        if (!empty($posterUrl)) {
140 140
                             $this->posterUrl = $posterUrl;
141 141
                             $this->getPoster($videoId);
142 142
                         }
143 143
                     }
144 144
 
145
-                    $seriesNo = (! empty($release['season']) ? preg_replace('/^S0*/i', '', $release['season']) : '');
146
-                    $episodeNo = (! empty($release['episode']) ? preg_replace('/^E0*/i', '', $release['episode']) : '');
147
-                    $hasAirdate = ! empty($release['airdate']);
145
+                    $seriesNo = (!empty($release['season']) ? preg_replace('/^S0*/i', '', $release['season']) : '');
146
+                    $episodeNo = (!empty($release['episode']) ? preg_replace('/^E0*/i', '', $release['episode']) : '');
147
+                    $hasAirdate = !empty($release['airdate']);
148 148
 
149 149
                     if ($episodeNo === 'all') {
150 150
                         $this->setVideoIdFound($videoId, $row['id'], 0);
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                         continue;
159 159
                     }
160 160
 
161
-                    if (! $this->countEpsByVideoID($videoId)) {
161
+                    if (!$this->countEpsByVideoID($videoId)) {
162 162
                         $this->getEpisodeInfo($siteId, -1, -1, $videoId);
163 163
                     }
164 164
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                         $highest = $show;
286 286
                     }
287 287
 
288
-                    if (! empty($show->aliases)) {
288
+                    if (!empty($show->aliases)) {
289 289
                         foreach ($show->aliases as $akaIndex => $akaName) {
290 290
                             $aliasPercent = $this->checkMatch(strtolower($akaName), strtolower($name), self::MATCH_PROBABILITY);
291 291
                             if ($aliasPercent > $highestMatch) {
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
                     }
297 297
                 }
298 298
             }
299
-            if (! empty($highest)) {
299
+            if (!empty($highest)) {
300 300
                 $return = $this->formatShowInfo($highest);
301 301
             }
302 302
         }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
         $ri = new ReleaseImageService;
310 310
         $hasCover = 0;
311 311
 
312
-        if (! empty($this->posterUrl)) {
312
+        if (!empty($this->posterUrl)) {
313 313
             $hasCover = $ri->saveImage($videoId, $this->posterUrl, $this->imgSavePath);
314 314
             if ($hasCover === 1) {
315 315
                 $this->setCoverFound($videoId);
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
     {
329 329
         $return = $response = false;
330 330
 
331
-        if (! $this->local) {
331
+        if (!$this->local) {
332 332
             if ($videoId > 0) {
333 333
                 try {
334 334
                     $response = $this->client->series()->allEpisodes($siteId);
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
         try {
381 381
             $poster = $this->client->series()->artworks($show->tvdb_id);
382 382
             $poster = collect($poster)->where('type', 2)->sortByDesc('score')->first();
383
-            $this->posterUrl = ! empty($poster->image) ? $poster->image : '';
383
+            $this->posterUrl = !empty($poster->image) ? $poster->image : '';
384 384
         } catch (ResourceNotFoundException $e) {
385 385
             cli()->error('Poster image not found on TVDB');
386 386
         } catch (UnauthorizedException $error) {
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
             'tvrage' => 0,
421 421
             'tvmaze' => 0,
422 422
             'tmdb' => $externalIds['tmdb'],
423
-            'aliases' => ! empty($show->aliases) ? $show->aliases : '',
423
+            'aliases' => !empty($show->aliases) ? $show->aliases : '',
424 424
             'localzone' => "''",
425 425
         ];
426 426
     }
@@ -452,10 +452,10 @@  discard block
 block discarded – undo
452 452
                 // Try TVDB ID first
453 453
                 if ($tvdbId > 0) {
454 454
                     $traktIds = $traktService->lookupShowIds($tvdbId, 'tvdb');
455
-                    if ($traktIds !== null && ! empty($traktIds['trakt'])) {
455
+                    if ($traktIds !== null && !empty($traktIds['trakt'])) {
456 456
                         $result['trakt'] = (int) $traktIds['trakt'];
457 457
                         // Also get TMDB if we didn't find it above
458
-                        if ($result['tmdb'] === 0 && ! empty($traktIds['tmdb'])) {
458
+                        if ($result['tmdb'] === 0 && !empty($traktIds['tmdb'])) {
459 459
                             $result['tmdb'] = (int) $traktIds['tmdb'];
460 460
                         }
461 461
                         return $result;
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
                 }
464 464
 
465 465
                 // Try IMDB ID as fallback
466
-                if (! empty($imdbId) && $imdbId > 0) {
466
+                if (!empty($imdbId) && $imdbId > 0) {
467 467
                     $traktIds = $traktService->lookupShowIds($imdbId, 'imdb');
468
-                    if ($traktIds !== null && ! empty($traktIds['trakt'])) {
468
+                    if ($traktIds !== null && !empty($traktIds['trakt'])) {
469 469
                         $result['trakt'] = (int) $traktIds['trakt'];
470
-                        if ($result['tmdb'] === 0 && ! empty($traktIds['tmdb'])) {
470
+                        if ($result['tmdb'] === 0 && !empty($traktIds['tmdb'])) {
471 471
                             $result['tmdb'] = (int) $traktIds['tmdb'];
472 472
                         }
473 473
                     }
Please login to merge, or discard this patch.
app/Services/TvProcessing/Pipes/TraktPipe.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         // Process episode
111
-        $seriesNo = ! empty($parsedInfo['season']) ? preg_replace('/^S0*/i', '', (string) $parsedInfo['season']) : '';
112
-        $episodeNo = ! empty($parsedInfo['episode']) ? preg_replace('/^E0*/i', '', (string) $parsedInfo['episode']) : '';
113
-        $hasAirdate = ! empty($parsedInfo['airdate']);
111
+        $seriesNo = !empty($parsedInfo['season']) ? preg_replace('/^S0*/i', '', (string) $parsedInfo['season']) : '';
112
+        $episodeNo = !empty($parsedInfo['episode']) ? preg_replace('/^E0*/i', '', (string) $parsedInfo['episode']) : '';
113
+        $hasAirdate = !empty($parsedInfo['airdate']);
114 114
 
115 115
         if ($episodeNo === 'all') {
116 116
             // Full season release
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         }
121 121
 
122 122
         // Download all episodes if new show to reduce API/bandwidth usage
123
-        if (! $trakt->countEpsByVideoID($videoId)) {
123
+        if (!$trakt->countEpsByVideoID($videoId)) {
124 124
             $trakt->getEpisodeInfo($siteId, -1, -1, $videoId);
125 125
         }
126 126
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      */
182 182
     private function outputFullSeason(string $title): void
183 183
     {
184
-        if (! $this->echoOutput) {
184
+        if (!$this->echoOutput) {
185 185
             return;
186 186
         }
187 187
 
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
         $context = $passable->context;
205 205
         $cleanName = $parsedInfo['cleanname'];
206 206
 
207
-        $seriesNo = ! empty($parsedInfo['season']) ? preg_replace('/^S0*/i', '', (string) $parsedInfo['season']) : '';
208
-        $episodeNo = ! empty($parsedInfo['episode']) ? preg_replace('/^E0*/i', '', (string) $parsedInfo['episode']) : '';
209
-        $hasAirdate = ! empty($parsedInfo['airdate']);
207
+        $seriesNo = !empty($parsedInfo['season']) ? preg_replace('/^S0*/i', '', (string) $parsedInfo['season']) : '';
208
+        $episodeNo = !empty($parsedInfo['episode']) ? preg_replace('/^E0*/i', '', (string) $parsedInfo['episode']) : '';
209
+        $hasAirdate = !empty($parsedInfo['airdate']);
210 210
 
211 211
         if ($episodeNo === 'all') {
212 212
             // Full season release
Please login to merge, or discard this patch.
app/Services/TvProcessing/Pipes/TmdbPipe.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
         }
112 112
 
113 113
         // Fetch poster if we have one
114
-        if (! empty($tmdbShow['poster'] ?? '')) {
114
+        if (!empty($tmdbShow['poster'] ?? '')) {
115 115
             $tmdb->getPoster($videoId);
116 116
         }
117 117
 
118 118
         // Process episode
119
-        $seriesNo = ! empty($parsedInfo['season']) ? preg_replace('/^S0*/i', '', (string) $parsedInfo['season']) : '';
120
-        $episodeNo = ! empty($parsedInfo['episode']) ? preg_replace('/^E0*/i', '', (string) $parsedInfo['episode']) : '';
121
-        $hasAirdate = ! empty($parsedInfo['airdate']);
119
+        $seriesNo = !empty($parsedInfo['season']) ? preg_replace('/^S0*/i', '', (string) $parsedInfo['season']) : '';
120
+        $episodeNo = !empty($parsedInfo['episode']) ? preg_replace('/^E0*/i', '', (string) $parsedInfo['episode']) : '';
121
+        $hasAirdate = !empty($parsedInfo['airdate']);
122 122
 
123 123
         if ($episodeNo === 'all') {
124 124
             // Full season release
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         }
129 129
 
130 130
         // Download all episodes if new show to reduce API/bandwidth usage
131
-        if (! $tmdb->countEpsByVideoID($videoId)) {
131
+        if (!$tmdb->countEpsByVideoID($videoId)) {
132 132
             $tmdb->getEpisodeInfo($siteId, -1, -1, '', $videoId);
133 133
         }
134 134
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      */
190 190
     private function outputFullSeason(string $title): void
191 191
     {
192
-        if (! $this->echoOutput) {
192
+        if (!$this->echoOutput) {
193 193
             return;
194 194
         }
195 195
 
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
         $context = $passable->context;
213 213
         $cleanName = $parsedInfo['cleanname'];
214 214
 
215
-        $seriesNo = ! empty($parsedInfo['season']) ? preg_replace('/^S0*/i', '', (string) $parsedInfo['season']) : '';
216
-        $episodeNo = ! empty($parsedInfo['episode']) ? preg_replace('/^E0*/i', '', (string) $parsedInfo['episode']) : '';
217
-        $hasAirdate = ! empty($parsedInfo['airdate']);
215
+        $seriesNo = !empty($parsedInfo['season']) ? preg_replace('/^S0*/i', '', (string) $parsedInfo['season']) : '';
216
+        $episodeNo = !empty($parsedInfo['episode']) ? preg_replace('/^E0*/i', '', (string) $parsedInfo['episode']) : '';
217
+        $hasAirdate = !empty($parsedInfo['airdate']);
218 218
 
219 219
         if ($episodeNo === 'all') {
220 220
             // Full season release
Please login to merge, or discard this patch.
app/Services/TmdbClient.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function isConfigured(): bool
41 41
     {
42
-        return ! empty($this->apiKey);
42
+        return !empty($this->apiKey);
43 43
     }
44 44
 
45 45
     /**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     protected function get(string $endpoint, array $params = []): ?array
53 53
     {
54
-        if (! $this->isConfigured()) {
54
+        if (!$this->isConfigured()) {
55 55
             Log::warning('TMDB API key is not configured');
56 56
 
57 57
             return null;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         try {
63 63
             $response = Http::timeout($this->timeout)
64
-                ->retry($this->retryTimes, $this->retryDelay, function (\Exception $exception, $request) {
64
+                ->retry($this->retryTimes, $this->retryDelay, function(\Exception $exception, $request) {
65 65
                     // Don't retry on 404 errors - resource simply doesn't exist
66 66
                     if ($exception instanceof \Illuminate\Http\Client\RequestException) {
67 67
                         return $exception->response->status() !== 404;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     {
160 160
         $params = [];
161 161
 
162
-        if (! empty($appendToResponse)) {
162
+        if (!empty($appendToResponse)) {
163 163
             $params['append_to_response'] = implode(',', $appendToResponse);
164 164
         }
165 165
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $params = [];
228 228
 
229
-        if (! empty($appendToResponse)) {
229
+        if (!empty($appendToResponse)) {
230 230
             $params['append_to_response'] = implode(',', $appendToResponse);
231 231
         }
232 232
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
         }
305 305
 
306 306
         $validSources = ['imdb_id', 'tvdb_id', 'tvrage_id'];
307
-        if (! in_array($source, $validSources, true)) {
307
+        if (!in_array($source, $validSources, true)) {
308 308
             return null;
309 309
         }
310 310
 
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
 
355 355
         // Try to find the show by IMDB ID
356 356
         $imdbId = $ids['imdb'] ?? 0;
357
-        if (! empty($imdbId)) {
357
+        if (!empty($imdbId)) {
358 358
             // Format IMDB ID with tt prefix if it's numeric
359 359
             $imdbFormatted = is_numeric($imdbId)
360
-                ? 'tt' . str_pad((string) $imdbId, 7, '0', STR_PAD_LEFT)
360
+                ? 'tt'.str_pad((string) $imdbId, 7, '0', STR_PAD_LEFT)
361 361
                 : (string) $imdbId;
362 362
 
363 363
             $show = $this->findTvByExternalId($imdbFormatted, 'imdb_id');
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
             $show = $this->findTvByExternalId((string) $id, 'tvdb_id');
398 398
         } elseif ($source === 'imdb') {
399 399
             $imdbFormatted = is_numeric($id)
400
-                ? 'tt' . str_pad((string) $id, 7, '0', STR_PAD_LEFT)
400
+                ? 'tt'.str_pad((string) $id, 7, '0', STR_PAD_LEFT)
401 401
                 : (string) $id;
402 402
             $show = $this->findTvByExternalId($imdbFormatted, 'imdb_id');
403 403
         }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 
409 409
         // If we found by external ID, we need to fetch external IDs for full data
410 410
         $tmdbId = self::getInt($show, 'id');
411
-        if ($tmdbId > 0 && ! isset($show['external_ids'])) {
411
+        if ($tmdbId > 0 && !isset($show['external_ids'])) {
412 412
             $externalIds = $this->getTvExternalIds($tmdbId);
413 413
             $show['external_ids'] = $externalIds ?? [];
414 414
         }
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 
418 418
         // Parse IMDB ID to numeric
419 419
         $imdbId = 0;
420
-        if (! empty($externalIds['imdb_id'])) {
420
+        if (!empty($externalIds['imdb_id'])) {
421 421
             preg_match('/tt(?P<imdbid>\d{6,7})$/i', $externalIds['imdb_id'], $imdb);
422 422
             $imdbId = (int) ($imdb['imdbid'] ?? 0);
423 423
         }
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
         $value = $data;
476 476
 
477 477
         foreach ($keys as $key) {
478
-            if (! is_array($value) || ! array_key_exists($key, $value)) {
478
+            if (!is_array($value) || !array_key_exists($key, $value)) {
479 479
                 return $default;
480 480
             }
481 481
             $value = $value[$key];
Please login to merge, or discard this patch.
app/Services/TraktService.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function isConfigured(): bool
48 48
     {
49
-        return ! empty($this->clientId);
49
+        return !empty($this->clientId);
50 50
     }
51 51
 
52 52
     /**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     protected function get(string $endpoint, array $params = []): ?array
72 72
     {
73
-        if (! $this->isConfigured()) {
73
+        if (!$this->isConfigured()) {
74 74
             Log::debug('Trakt API key is not configured');
75 75
 
76 76
             return null;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         try {
82 82
             $response = Http::timeout($this->timeout)
83
-                ->retry($this->retryTimes, $this->retryDelay, function (\Exception $exception, $request) {
83
+                ->retry($this->retryTimes, $this->retryDelay, function(\Exception $exception, $request) {
84 84
                     // Don't retry on 404 errors - resource simply doesn't exist
85 85
                     if ($exception instanceof \Illuminate\Http\Client\RequestException) {
86 86
                         return $exception->response->status() !== 404;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
         $cacheKey = "trakt_episode_{$idType}_{$showId}_{$season}_{$episode}_{$extended}";
180 180
 
181
-        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function () use ($formattedId, $season, $episode, $extended) {
181
+        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function() use ($formattedId, $season, $episode, $extended) {
182 182
             return $this->get("shows/{$formattedId}/seasons/{$season}/episodes/{$episode}", [
183 183
                 'extended' => $extended,
184 184
             ]);
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         $idPriority = ['trakt', 'tmdb', 'tvdb', 'imdb'];
206 206
 
207 207
         foreach ($idPriority as $idType) {
208
-            if (! empty($ids[$idType]) && $ids[$idType] > 0) {
208
+            if (!empty($ids[$idType]) && $ids[$idType] > 0) {
209 209
                 $result = $this->getEpisodeSummary($ids[$idType], $season, $episode, $extended, $idType);
210 210
                 if ($result !== null) {
211 211
                     return $result;
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
      */
227 227
     protected function formatShowIdForApi(int|string $id, string $idType): ?string
228 228
     {
229
-        if (! in_array($idType, self::ID_TYPES, true)) {
229
+        if (!in_array($idType, self::ID_TYPES, true)) {
230 230
             return null;
231 231
         }
232 232
 
233 233
         return match ($idType) {
234
-            'imdb' => is_numeric($id) ? 'tt' . str_pad((string) $id, 7, '0', STR_PAD_LEFT) : (string) $id,
234
+            'imdb' => is_numeric($id) ? 'tt'.str_pad((string) $id, 7, '0', STR_PAD_LEFT) : (string) $id,
235 235
             'trakt' => (string) $id,
236 236
             'tmdb', 'tvdb' => (string) $id,
237 237
             default => null,
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
         $cacheKey = "trakt_show_ids_{$idType}_{$showId}";
257 257
 
258
-        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function () use ($formattedId) {
258
+        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function() use ($formattedId) {
259 259
             return $this->get("shows/{$formattedId}", ['extended' => 'full']);
260 260
         });
261 261
     }
@@ -270,20 +270,20 @@  discard block
 block discarded – undo
270 270
      */
271 271
     public function lookupShowIds(int|string $id, string $idType = 'tmdb'): ?array
272 272
     {
273
-        if (! in_array($idType, self::ID_TYPES, true)) {
273
+        if (!in_array($idType, self::ID_TYPES, true)) {
274 274
             return null;
275 275
         }
276 276
 
277 277
         // Use the search endpoint to find the show by external ID
278 278
         $results = $this->searchById($id, $idType, 'show');
279 279
 
280
-        if (empty($results) || ! is_array($results)) {
280
+        if (empty($results) || !is_array($results)) {
281 281
             return null;
282 282
         }
283 283
 
284 284
         // Get the first matching show
285 285
         $show = $results[0]['show'] ?? null;
286
-        if ($show === null || ! isset($show['ids'])) {
286
+        if ($show === null || !isset($show['ids'])) {
287 287
             return null;
288 288
         }
289 289
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
     {
307 307
         $cacheKey = 'trakt_boxoffice_'.date('Y-m-d');
308 308
 
309
-        return Cache::remember($cacheKey, now()->addHours(6), function () {
309
+        return Cache::remember($cacheKey, now()->addHours(6), function() {
310 310
             return $this->get('movies/boxoffice');
311 311
         });
312 312
     }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
         $cacheKey = "trakt_calendar_{$startDate}_{$days}";
328 328
 
329
-        return Cache::remember($cacheKey, now()->addHours(6), function () use ($startDate, $days) {
329
+        return Cache::remember($cacheKey, now()->addHours(6), function() use ($startDate, $days) {
330 330
             return $this->get("calendars/all/shows/{$startDate}/{$days}");
331 331
         });
332 332
     }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         $slug = Str::slug($movie);
349 349
         $cacheKey = "trakt_movie_{$slug}_{$extended}";
350 350
 
351
-        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function () use ($slug, $extended) {
351
+        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function() use ($slug, $extended) {
352 352
             return $this->get("movies/{$slug}", ['extended' => $extended]);
353 353
         });
354 354
     }
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
      */
377 377
     public function searchById(int|string $id, string $idType = 'trakt', string $mediaType = ''): ?array
378 378
     {
379
-        if (! in_array($idType, self::ID_TYPES, true)) {
379
+        if (!in_array($idType, self::ID_TYPES, true)) {
380 380
             Log::warning('Trakt: Invalid ID type', ['idType' => $idType]);
381 381
 
382 382
             return null;
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
             'id' => $id,
393 393
         ];
394 394
 
395
-        if (! empty($mediaType)) {
395
+        if (!empty($mediaType)) {
396 396
             $params['type'] = $mediaType;
397 397
         }
398 398
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
         $slug = Str::slug($query);
417 417
         $cacheKey = "trakt_search_{$type}_{$slug}";
418 418
 
419
-        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function () use ($query, $type) {
419
+        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function() use ($query, $type) {
420 420
             return $this->get('search/'.$type, ['query' => $query]);
421 421
         });
422 422
     }
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
         $slug = Str::slug($show);
439 439
         $cacheKey = "trakt_show_{$slug}_{$extended}";
440 440
 
441
-        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function () use ($slug, $extended) {
441
+        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function() use ($slug, $extended) {
442 442
             return $this->get("shows/{$slug}", ['extended' => $extended]);
443 443
         });
444 444
     }
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         $slug = Str::slug($show);
460 460
         $cacheKey = "trakt_seasons_{$slug}_{$extended}";
461 461
 
462
-        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function () use ($slug, $extended) {
462
+        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function() use ($slug, $extended) {
463 463
             return $this->get("shows/{$slug}/seasons", ['extended' => $extended]);
464 464
         });
465 465
     }
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
         $slug = Str::slug($show);
482 482
         $cacheKey = "trakt_season_episodes_{$slug}_{$season}_{$extended}";
483 483
 
484
-        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function () use ($slug, $season, $extended) {
484
+        return Cache::remember($cacheKey, now()->addHours(self::CACHE_TTL_HOURS), function() use ($slug, $season, $extended) {
485 485
             return $this->get("shows/{$slug}/seasons/{$season}", ['extended' => $extended]);
486 486
         });
487 487
     }
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
     {
498 498
         $cacheKey = "trakt_trending_shows_{$limit}_{$extended}";
499 499
 
500
-        return Cache::remember($cacheKey, now()->addHours(1), function () use ($limit, $extended) {
500
+        return Cache::remember($cacheKey, now()->addHours(1), function() use ($limit, $extended) {
501 501
             return $this->get('shows/trending', [
502 502
                 'limit' => $limit,
503 503
                 'extended' => $extended,
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
     {
517 517
         $cacheKey = "trakt_trending_movies_{$limit}_{$extended}";
518 518
 
519
-        return Cache::remember($cacheKey, now()->addHours(1), function () use ($limit, $extended) {
519
+        return Cache::remember($cacheKey, now()->addHours(1), function() use ($limit, $extended) {
520 520
             return $this->get('movies/trending', [
521 521
                 'limit' => $limit,
522 522
                 'extended' => $extended,
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     {
536 536
         $cacheKey = "trakt_popular_shows_{$limit}_{$extended}";
537 537
 
538
-        return Cache::remember($cacheKey, now()->addHours(6), function () use ($limit, $extended) {
538
+        return Cache::remember($cacheKey, now()->addHours(6), function() use ($limit, $extended) {
539 539
             return $this->get('shows/popular', [
540 540
                 'limit' => $limit,
541 541
                 'extended' => $extended,
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
     {
555 555
         $cacheKey = "trakt_popular_movies_{$limit}_{$extended}";
556 556
 
557
-        return Cache::remember($cacheKey, now()->addHours(6), function () use ($limit, $extended) {
557
+        return Cache::remember($cacheKey, now()->addHours(6), function() use ($limit, $extended) {
558 558
             return $this->get('movies/popular', [
559 559
                 'limit' => $limit,
560 560
                 'extended' => $extended,
Please login to merge, or discard this patch.