Passed
Pull Request — master (#262)
by Pascal
02:52
created

MediaOpenerFactory::dynamicHLSPlaylist()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace ProtoneMedia\LaravelFFMpeg\Support;
4
5
use Illuminate\Support\Traits\ForwardsCalls;
6
use ProtoneMedia\LaravelFFMpeg\Drivers\PHPFFMpeg;
7
use ProtoneMedia\LaravelFFMpeg\Http\DynamicHLSPlaylist;
8
use ProtoneMedia\LaravelFFMpeg\MediaOpener;
9
10
class MediaOpenerFactory
11
{
12
    use ForwardsCalls;
13
14
    private $defaultDisk;
15
    private $driver;
16
17
    public function __construct(string $defaultDisk, PHPFFMpeg $driver)
18
    {
19
        $this->defaultDisk = $defaultDisk;
20
        $this->driver      = $driver;
21
    }
22
23
    public function new(): MediaOpener
24
    {
25
        return new MediaOpener($this->defaultDisk, $this->driver);
26
    }
27
28
    public function dynamicHLSPlaylist(): DynamicHLSPlaylist
29
    {
30
        return new DynamicHLSPlaylist($this->defaultDisk);
0 ignored issues
show
Unused Code introduced by
The call to ProtoneMedia\LaravelFFMp...Playlist::__construct() has too many arguments starting with $this->defaultDisk. ( Ignorable by Annotation )

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

30
        return /** @scrutinizer ignore-call */ new DynamicHLSPlaylist($this->defaultDisk);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
31
    }
32
33
    /**
34
    * Handle dynamic method calls into the MediaOpener.
35
    *
36
    * @param  string  $method
37
    * @param  array  $parameters
38
    * @return mixed
39
    */
40
    public function __call($method, $parameters)
41
    {
42
        return $this->forwardCallTo($this->new(), $method, $parameters);
43
    }
44
}
45