Completed
Pull Request — master (#111)
by Jan Philipp
07:12 queued 01:44
created

DeferredProcessCommand   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 66
loc 66
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 13 13 1
A getShellCommand() 4 4 1
A isIgnoreError() 4 4 1
A getLineNumber() 4 4 1
A isTTy() 4 4 1
A getWorkingDirectory() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php declare(strict_types=1);
2
3
namespace Shopware\Psh\ScriptRuntime;
4
5
/**
6
 * A single command of a script
7
 */
8 View Code Duplication
class DeferredProcessCommand implements ProcessCommand, ParsableCommand
0 ignored issues
show
Duplication introduced by
This class 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...
9
{
10
    /**
11
     * @var string
12
     */
13
    private $shellCommand;
14
15
    /**
16
     * @var bool
17
     */
18
    private $ignoreError;
19
20
    /**
21
     * @var int
22
     */
23
    private $lineNumber;
24
25
    /**
26
     * @var bool
27
     */
28
    private $tty;
29
30
    /**
31
     * @var string
32
     */
33
    private $workingDirectory;
34
35
    public function __construct(
36
        string $shellCommand,
37
        int $lineNumber,
38
        bool $ignoreError,
39
        bool $tty,
40
        string $workingDirectory
41
    ) {
42
        $this->shellCommand = $shellCommand;
43
        $this->ignoreError = $ignoreError;
44
        $this->lineNumber = $lineNumber;
45
        $this->tty = $tty;
46
        $this->workingDirectory = $workingDirectory;
47
    }
48
49
    public function getShellCommand(): string
50
    {
51
        return $this->shellCommand;
52
    }
53
54
    public function isIgnoreError(): bool
55
    {
56
        return $this->ignoreError;
57
    }
58
59
    public function getLineNumber(): int
60
    {
61
        return $this->lineNumber;
62
    }
63
64
    public function isTTy(): bool
65
    {
66
        return $this->tty;
67
    }
68
69
    public function getWorkingDirectory(): string
70
    {
71
        return $this->workingDirectory;
72
    }
73
}
74