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

ProcessParams   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 64
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getEnv() 0 3 1
A getTimeout() 0 3 1
A getIdleTimeout() 0 3 1
A setIdleTimeout() 0 3 1
A setEnv() 0 3 1
A setTimeout() 0 3 1
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