Passed
Push — master ( af560c...690258 )
by Sébastien
03:19
created

FFProbeConfig::getBinary()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Video\Config;
6
7
class FFProbeConfig implements FFProbeConfigInterface
8
{
9
    public const DEFAULT_BINARY       = 'ffmpeg';
10
    public const DEFAULT_TIMEOUT      = null;
11
    public const DEFAULT_IDLE_TIMEOUT = null;
12
    public const DEFAULT_ENV          = [];
13
14
    /** @var string */
15
    protected $binary;
16
17
    /** @var float|null */
18
    protected $timeout;
19
20
    /** @var float|null */
21
    protected $idleTimeout;
22
23
    /** @var array<string, string|int> */
24
    protected $env;
25
26
    /**
27
     * @param string                    $ffprobeBinary FFProbeBinary, by default ffprobe
28
     * @param float|null                $timeout       max allowed time (in seconds) for conversion, null for no timeout
29
     * @param float|null                $idleTimeout   max allowed idle time (in seconds) for conversion, null for no timeout
30
     * @param array<string, string|int> $env           An array of additional env vars to set when running the ffprobe process
31
     */
32
    public function __construct(
33
        string $ffprobeBinary = self::DEFAULT_BINARY,
34
        ?float $timeout = self::DEFAULT_TIMEOUT,
35
        ?float $idleTimeout = self::DEFAULT_IDLE_TIMEOUT,
36
        array $env = self::DEFAULT_ENV
37
    ) {
38
        $this->binary      = $ffprobeBinary;
39
        $this->timeout     = $timeout;
40
        $this->idleTimeout = $idleTimeout;
41
        $this->env         = $env;
42
    }
43
44
    public function getBinary(): string
45
    {
46
        return $this->binary;
47
    }
48
49
    public function getTimeout(): ?float
50
    {
51
        return $this->timeout;
52
    }
53
54
    public function getIdleTimeout(): ?float
55
    {
56
        return $this->idleTimeout;
57
    }
58
59
    /**
60
     * @return array<string, string|int>
61
     */
62
    public function getEnv(): array
63
    {
64
        return $this->env;
65
    }
66
}
67