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

ProcessValueProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 24
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getValue() 0 6 1
A getCommand() 0 4 1
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