Completed
Pull Request — master (#536)
by
unknown
03:50 queued 42s
created

ProcessExecutor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 7
dl 0
loc 29
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getCommand() 0 4 1
A run() 0 4 1
1
<?php
2
3
namespace Robo\Common;
4
5
use Robo\Contract\OutputAwareInterface;
6
use Robo\Contract\VerbosityThresholdInterface;
7
use Robo\Robo;
8
use Symfony\Component\Process\Process;
9
10
class ProcessExecutor implements OutputAwareInterface
11
{
12
    use ExecTrait;
13
    use TaskIO; // uses LoggerAwareTrait and ConfigAwareTrait
14
    use ProgressIndicatorAwareTrait;
15
    use OutputAwareTrait;
16
17
    public function __construct(Process $process)
18
    {
19
        $this->process = $process;
20
        $this->logger = Robo::logger();
21
        $this->setOutputAdapter(new OutputAdapter());
22
        $this->outputAdapter()->setOutput(Robo::output());
23
        $this->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_NORMAL);
24
    }
25
26
    /**
27
     * @return string
28
     */
29
    public function getCommand()
30
    {
31
        return $this->process->getCommandLine();
32
    }
33
34
    public function run()
35
    {
36
        return $this->execute($this->process);
37
    }
38
}
39