Passed
Push — master ( 4744e0...bd9fc8 )
by Sébastien
02:34
created

FFMpegConfig::getConversionIdleTimeout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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