Passed
Pull Request — master (#232)
by Pascal
03:52
created

AdvancedMedia   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A make() 0 3 1
A buildCommand() 0 19 3
1
<?php
2
3
namespace ProtoneMedia\LaravelFFMpeg\FFMpeg;
4
5
use FFMpeg\Media\AdvancedMedia as MediaAdvancedMedia;
6
7
class AdvancedMedia extends MediaAdvancedMedia
8
{
9
    use InteractsWithHttpHeaders;
10
11
    public static function make(MediaAdvancedMedia $media)
12
    {
13
        return new static($media->getInputs(), $media->getFFMpegDriver(), FFProbe::make($media->getFFProbe()));
14
    }
15
16
    /**
17
     * @return array
18
     */
19
    protected function buildCommand()
20
    {
21
        $command = parent::buildCommand();
22
23
        $inputKey = array_search($this->getPathfile(), $command) - 1;
0 ignored issues
show
Unused Code introduced by
The assignment to $inputKey is dead and can be removed.
Loading history...
24
25
        foreach ($this->getInputs() as $inputKey => $path) {
26
            $headers = $this->headers[$inputKey];
27
            $inputKey += 2;
28
29
            if (empty($headers)) {
30
                continue;
31
            }
32
33
            $command = static::mergeBeforePathInput($command, $path, static::compileHeaders($headers));
34
            $inputKey += 2;
35
        }
36
37
        return $command;
38
    }
39
}
40