Completed
Push — master ( 40cd32...2cd668 )
by Pascal
02:13
created

FrameExporter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A accurate() 0 6 1
A unaccurate() 0 6 1
A getAccuracy() 0 4 1
A saveFrame() 0 6 1
1
<?php
2
3
namespace Pbmedia\LaravelFFMpeg;
4
5
class FrameExporter extends MediaExporter
6
{
7
    protected $mustBeAccurate = false;
8
9
    protected $saveMethod = 'saveFrame';
10
11
    public function accurate(): MediaExporter
12
    {
13
        $this->mustBeAccurate = true;
14
15
        return $this;
16
    }
17
18
    public function unaccurate(): MediaExporter
19
    {
20
        $this->mustBeAccurate = false;
21
22
        return $this;
23
    }
24
25
    public function getAccuracy(): bool
26
    {
27
        return $this->mustBeAccurate;
28
    }
29
30
    private function saveFrame(string $fullPath): MediaExporter
31
    {
32
        $this->media->save($fullPath, $this->getAccuracy());
0 ignored issues
show
Documentation introduced by
$fullPath is of type string, but the function expects a object<Pbmedia\LaravelFFMpeg\FormatInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
33
34
        return $this;
35
    }
36
}
37