Issues (76)

src/FFMpeg/RebuildsCommands.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace ProtoneMedia\LaravelFFMpeg\FFMpeg;
4
5
use FFMpeg\Format\FormatInterface;
6
use Illuminate\Support\Collection;
7
8
trait RebuildsCommands
9
{
10
    use InteractsWithBeforeSavingCallbacks;
11
    use InteractsWithHttpHeaders;
12
13
    /**
14
     * Builds the command using the underlying library and then
15
     * prepends the input with the headers.
16
     *
17
     * @param \FFMpeg\Format\FormatInterface $format
18
     * @param string $outputPathfile
19
     * @return array
20
     */
21
    protected function buildCommand(FormatInterface $format, $outputPathfile)
22
    {
23
        $command = parent::buildCommand($format, $outputPathfile);
24
25
        $command = $this->rebuildCommandWithHeaders($command);
26
        $command = $this->rebuildCommandWithCallbacks($command);
27
28
        return $command;
29
    }
30
31
    private function rebuildCommandWithHeaders($command)
32
    {
33
        if (empty($this->headers)) {
34
            return $command;
35
        }
36
37
        return Collection::make($command)->map(function ($command) {
38
            return static::mergeBeforePathInput(
39
                $command,
40
                $this->getPathfile(),
0 ignored issues
show
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

40
                $this->/** @scrutinizer ignore-call */ 
41
                       getPathfile(),
Loading history...
41
                static::compileHeaders($this->headers)
42
            );
43
        })->all();
44
    }
45
}
46