Completed
Push — master ( d234f3...0a4926 )
by Jan Philipp
47s queued 12s
created

ProcessValueProvider::getValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

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