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

ProcessExecutor::getCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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