Passed
Pull Request — master (#265)
by Pascal
05:56
created

FFProbeDriver::command()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 7
c 1
b 0
f 0
nc 4
nop 3
dl 0
loc 14
rs 10
1
<?php
2
3
namespace ProtoneMedia\LaravelFFMpeg\FFMpeg;
4
5
use FFMpeg\Driver\FFProbeDriver as FFMpegFFProbeDriver;
6
7
class FFProbeDriver extends FFMpegFFProbeDriver
8
{
9
    private $pendingWorkingDirectory;
10
11
    public function setWorkingDirectory(string $directory): self
12
    {
13
        $this->pendingWorkingDirectory = $directory;
14
15
        return $this;
16
    }
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function command($command, $bypassErrors = false, $listeners = null)
22
    {
23
        if (!is_array($command)) {
24
            $command = [$command];
25
        }
26
27
        $process = $this->factory->create($command);
28
29
        if ($this->pendingWorkingDirectory) {
30
            $process->setWorkingDirectory($this->pendingWorkingDirectory);
31
            $this->pendingWorkingDirectory = null;
32
        }
33
34
        return $this->run($process, $bypassErrors, $listeners);
35
    }
36
}
37