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

NfoProcessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A process() 0 9 2
1
<?php
2
3
namespace App\Services;
4
5
use App\Models\Settings;
6
use Blacklight\Nfo;
7
use Blacklight\NNTP;
8
9
class NfoProcessor
10
{
11
    private Nfo $nfo;
12
13
    public function __construct(Nfo $nfo, bool $echooutput)
0 ignored issues
show
Unused Code introduced by
The parameter $echooutput is not used and could be removed. ( Ignorable by Annotation )

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

13
    public function __construct(Nfo $nfo, /** @scrutinizer ignore-unused */ bool $echooutput)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
14
    {
15
        $this->nfo = $nfo;
16
        // echooutput kept for signature parity
17
    }
18
19
    /**
20
     * Process NFO files if enabled by settings.
21
     */
22
    public function process(NNTP $nntp, string $groupID = '', string $guidChar = ''): void
23
    {
24
        if ((int) Settings::settingValue('lookupnfo') === 1) {
25
            $this->nfo->processNfoFiles(
26
                $nntp,
27
                $groupID,
28
                $guidChar,
29
                (int) Settings::settingValue('lookupimdb'),
0 ignored issues
show
Bug introduced by
(int)App\Models\Settings...tingValue('lookupimdb') of type integer is incompatible with the type boolean expected by parameter $processImdb of Blacklight\Nfo::processNfoFiles(). ( Ignorable by Annotation )

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

29
                /** @scrutinizer ignore-type */ (int) Settings::settingValue('lookupimdb'),
Loading history...
30
                (int) Settings::settingValue('lookuptv')
0 ignored issues
show
Bug introduced by
(int)App\Models\Settings...ettingValue('lookuptv') of type integer is incompatible with the type boolean expected by parameter $processTv of Blacklight\Nfo::processNfoFiles(). ( Ignorable by Annotation )

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

30
                /** @scrutinizer ignore-type */ (int) Settings::settingValue('lookuptv')
Loading history...
31
            );
32
        }
33
    }
34
}
35