Completed
Push — master ( 1ece6c...656998 )
by Jan Philipp
13s queued 11s
created

ProcessValueProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Psh\ScriptRuntime\Execution;
4
5
use Symfony\Component\Process\Process;
6
7
/**
8
 * Enables lazy initialization of variables
9
 */
10
class ProcessValueProvider implements ValueProvider
11
{
12
    /**
13
     * @var Process
14
     */
15
    private $process;
16
17
    public function __construct(Process $process)
18
    {
19
        $this->process = $process;
20
    }
21
22
    /**
23
     * @return mixed
24
     */
25
    public function getValue(): string
26
    {
27
        $this->process->mustRun();
28
29
        return trim($this->process->getOutput());
30
    }
31
}
32