Completed
Pull Request — master (#82)
by Jan Philipp
02:07
created

DeferredProcessCommand   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 73
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 73
loc 73
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
     * @param bool $deferred
0 ignored issues
show
Bug introduced by
There is no parameter named $deferred. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
37
     */
38
    public function __construct(
39
        string $shellCommand,
40
        int $lineNumber,
41
        bool $ignoreError,
42
        bool $tty
43
    ) {
44
        $this->shellCommand = $shellCommand;
45
        $this->ignoreError = $ignoreError;
46
        $this->lineNumber = $lineNumber;
47
        $this->tty = $tty;
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function getShellCommand(): string
54
    {
55
        return $this->shellCommand;
56
    }
57
58
    /**
59
     * @return boolean
60
     */
61
    public function isIgnoreError(): bool
62
    {
63
        return $this->ignoreError;
64
    }
65
66
    /**
67
     * @return int
68
     */
69
    public function getLineNumber(): int
70
    {
71
        return $this->lineNumber;
72
    }
73
74
    /**
75
     * @return bool
76
     */
77
    public function isTTy(): bool
78
    {
79
        return $this->tty;
80
    }
81
}
82