ProcessExecutor::getCommandDescription()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Robo\Common;
4
5
use Psr\Log\LoggerAwareInterface;
6
use Robo\Contract\ConfigAwareInterface;
7
use Robo\Contract\OutputAwareInterface;
8
use Robo\Contract\VerbosityThresholdInterface;
9
use Symfony\Component\Process\Process;
10
11
class ProcessExecutor implements ConfigAwareInterface, LoggerAwareInterface, OutputAwareInterface, VerbosityThresholdInterface
12
{
13
    use ExecTrait;
14
    use TaskIO; // uses LoggerAwareTrait and ConfigAwareTrait
15
    use ProgressIndicatorAwareTrait;
16
    use OutputAwareTrait;
17
18
    /**
19
     * @param \Symfony\Component\Process\Process $process
20
     */
21
    public function __construct(Process $process)
22
    {
23
        $this->process = $process;
24
    }
25
26
    /**
27
     * @param \League\Container\ContainerInterface $container
28
     * @param \Symfony\Component\Process\Process $process
29
     *
30
     * @return static
31
     */
32 View Code Duplication
    public static function create($container, $process)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
    {
34
        $processExecutor = new self($process);
35
36
        $processExecutor->setLogger($container->get('logger'));
37
        $processExecutor->setProgressIndicator($container->get('progressIndicator'));
38
        $processExecutor->setConfig($container->get('config'));
39
        $processExecutor->setOutputAdapter($container->get('outputAdapter'));
40
41
        return $processExecutor;
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    protected function getCommandDescription()
48
    {
49
        return $this->process->getCommandLine();
50
    }
51
52
    public function run()
53
    {
54
        return $this->execute($this->process);
55
    }
56
}
57