These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Robo\Task\Docker; |
||
3 | |||
4 | /** |
||
5 | * Starts Docker container |
||
6 | * |
||
7 | * ```php |
||
8 | * <?php |
||
9 | * $this->taskDockerStart($cidOrResult) |
||
10 | * ->run(); |
||
11 | * ?> |
||
12 | * ``` |
||
13 | */ |
||
14 | View Code Duplication | class Start extends Base |
|
0 ignored issues
–
show
|
|||
15 | { |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $command = "docker start"; |
||
20 | |||
21 | /** |
||
22 | * @var null|string |
||
23 | */ |
||
24 | protected $cid; |
||
25 | |||
26 | /** |
||
27 | * @param string|\Robo\Task\Docker\Result $cidOrResult |
||
28 | */ |
||
29 | public function __construct($cidOrResult) |
||
30 | { |
||
31 | $this->cid = $cidOrResult instanceof Result ? $cidOrResult->getCid() : $cidOrResult; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | public function getCommand() |
||
38 | { |
||
39 | return $this->command . ' ' . $this->arguments . ' ' . $this->cid; |
||
40 | } |
||
41 | } |
||
42 |
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.