Completed
Push — master ( 1ece6c...656998 )
by Jan Philipp
13s queued 11s
created

DeferredProcessCommand   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 72
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 72
loc 72
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 11 11 1
A getShellCommand() 4 4 1
A isIgnoreError() 4 4 1
A getLineNumber() 4 4 1
A isTTy() 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
4
namespace Shopware\Psh\ScriptRuntime;
5
6
/**
7
 * A single command of a script
8
 */
9 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...
10
{
11
    /**
12
     * @var string
13
     */
14
    private $shellCommand;
15
16
    /**
17
     * @var bool
18
     */
19
    private $ignoreError;
20
21
    /**
22
     * @var int
23
     */
24
    private $lineNumber;
25
26
    /**
27
     * @var bool
28
     */
29
    private $tty;
30
31
    /**
32
     * @param string $shellCommand
33
     * @param int $lineNumber
34
     * @param bool $ignoreError
35
     * @param bool $tty
36
     */
37
    public function __construct(
38
        string $shellCommand,
39
        int $lineNumber,
40
        bool $ignoreError,
41
        bool $tty
42
    ) {
43
        $this->shellCommand = $shellCommand;
44
        $this->ignoreError = $ignoreError;
45
        $this->lineNumber = $lineNumber;
46
        $this->tty = $tty;
47
    }
48
49
    /**
50
     * @return string
51
     */
52
    public function getShellCommand(): string
53
    {
54
        return $this->shellCommand;
55
    }
56
57
    /**
58
     * @return boolean
59
     */
60
    public function isIgnoreError(): bool
61
    {
62
        return $this->ignoreError;
63
    }
64
65
    /**
66
     * @return int
67
     */
68
    public function getLineNumber(): int
69
    {
70
        return $this->lineNumber;
71
    }
72
73
    /**
74
     * @return bool
75
     */
76
    public function isTTy(): bool
77
    {
78
        return $this->tty;
79
    }
80
}
81