Passed
Push — master ( cf4530...c38ca0 )
by Sébastien
02:37
created

ProcessParams::setEnv()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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