Completed
Pull Request — master (#109)
by Jan Philipp
01:37
created

ProcessValueProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 27
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
    /**
24
     * @return mixed
25
     */
26
    public function getValue(): string
27
    {
28
        $this->process->mustRun();
29
30
        return trim($this->process->getOutput());
31
    }
32
33
    public function getCommand(): string
34
    {
35
        return $this->process->getCommandLine();
36
    }
37
}
38