Passed
Push — master ( 6309f1...8af892 )
by Pascal
02:12
created

BuildsCommandsWithHttpHeaders::buildCommand()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 9
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 15
rs 9.9666
1
<?php
2
3
namespace ProtoneMedia\LaravelFFMpeg\FFMpeg;
4
5
use FFMpeg\Format\FormatInterface;
6
use Illuminate\Support\Collection;
7
8
trait BuildsCommandsWithHttpHeaders
9
{
10
    use InteractsWithHttpHeaders;
11
12
    /**
13
     * Builds the command using the underlying library and then
14
     * prepends the input with the headers.
15
     *
16
     * @param \FFMpeg\Format\FormatInterface $format
17
     * @param string $outputPathfile
18
     * @return array
19
     */
20
    protected function buildCommand(FormatInterface $format, $outputPathfile)
21
    {
22
        $command = parent::buildCommand($format, $outputPathfile);
23
24
        if (empty($this->headers)) {
25
            return $command;
26
        }
27
28
        return Collection::make($command)->map(function ($command) {
29
            return static::mergeBeforePathInput(
30
                $command,
31
                $this->getPathfile(),
0 ignored issues
show
Bug introduced by
It seems like getPathfile() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

31
                $this->/** @scrutinizer ignore-call */ 
32
                       getPathfile(),
Loading history...
32
                static::compileHeaders($this->headers)
33
            );
34
        })->all();
35
    }
36
}
37