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

AdvancedMedia::buildCommand()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

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