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

TvProcessor::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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