Failed Conditions
Push — master ( 85c284...561f65 )
by Sébastien
02:44
created

FFMpegConfig::getProcess()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Config;
6
7
class FFMpegConfig
8
{
9
    /** @var string */
10
    protected $binary;
11
12
    /** @var int|null */
13
    protected $threads;
14
15
    /** @var int|null */
16
    protected $conversionTimeout;
17
18
    /** @var int|null */
19
    protected $conversionIdleTimeout;
20
21
    /** @var array<string, string|int> */
22
    protected $conversionEnv;
23
24
    /**
25
     * FFMpegConfig constructor.
26
     *
27
     * @param string                    $binary
28
     * @param int|null                  $threads               number fo threads used for conversion, null means single threads, 0 all cores, ....
29
     * @param int|null                  $conversionTimeout     max allowed time (in seconds) for conversion
30
     * @param int|null                  $conversionIdleTimeout max allowed idle time (in seconds) for conversion
31
     * @param array<string, string|int> $conversionEnv         An array of additional env vars to set when running the ffmpeg conversion process
32
     */
33 13
    public function __construct(string $binary, ?int $threads = null, ?int $conversionTimeout = null, ?int $conversionIdleTimeout = null, array $conversionEnv = [])
34
    {
35 13
        $this->binary                = $binary;
36 13
        $this->threads               = $threads;
37 13
        $this->conversionTimeout     = $conversionTimeout;
38 13
        $this->conversionIdleTimeout = $conversionIdleTimeout;
39 13
        $this->conversionEnv         = $conversionEnv;
40 13
    }
41
42 6
    public function getBinary(): string
43
    {
44 6
        return $this->binary;
45
    }
46
47 3
    public function getThreads(): ?int
48
    {
49 3
        return $this->threads;
50
    }
51
52 5
    public function getConversionTimeout(): ?int
53
    {
54 5
        return $this->conversionTimeout;
55
    }
56
57
    /**
58
     * @return array<string, string|int>
59
     */
60 5
    public function getConversionEnv(): array
61
    {
62 5
        return $this->conversionEnv;
63
    }
64
65 5
    public function getConversionIdleTimeout(): ?int
66
    {
67 5
        return $this->conversionIdleTimeout;
68
    }
69
}
70