Passed
Push — master ( b2d632...002539 )
by Darko
10:06
created

TvProcessor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 4
eloc 9
c 2
b 1
f 0
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 8 3
A __construct() 0 3 1
1
<?php
2
3
namespace App\Services;
4
5
use App\Models\Settings;
6
use Blacklight\processing\tv\TMDB;
7
use Blacklight\processing\tv\TraktTv;
8
use Blacklight\processing\tv\TVDB;
9
use Blacklight\processing\tv\TVMaze;
10
11
class TvProcessor
12
{
13
    private bool $echooutput;
14
15
    public function __construct(bool $echooutput)
16
    {
17
        $this->echooutput = $echooutput;
18
    }
19
20
    /**
21
     * Process all TV related releases across supported providers.
22
     *
23
     * @param  int|string|null  $processTV  0/1/2 or '' to read from settings
24
     */
25
    public function process(string $groupID = '', string $guidChar = '', int|string|null $processTV = ''): void
26
    {
27
        $processTV = (is_numeric($processTV) ? $processTV : Settings::settingValue('lookuptv'));
28
        if ($processTV > 0) {
29
            (new TVDB)->processSite($groupID, $guidChar, $processTV);
30
            (new TVMaze)->processSite($groupID, $guidChar, $processTV);
31
            (new TMDB)->processSite($groupID, $guidChar, $processTV);
32
            (new TraktTv)->processSite($groupID, $guidChar, $processTV);
0 ignored issues
show
Bug introduced by
It seems like $processTV can also be of type string; however, parameter $process of Blacklight\processing\tv\TraktTv::processSite() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

32
            (new TraktTv)->processSite($groupID, $guidChar, /** @scrutinizer ignore-type */ $processTV);
Loading history...
33
        }
34
    }
35
}
36