Completed
Pull Request — master (#1)
by Woody
27:07 queued 01:07
created

Payload::withMessages()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4286
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
namespace Equip;
3
4
use Equip\Adr\PayloadInterface;
5
6
class Payload implements PayloadInterface
7
{
8
    /**
9
     * @var integer
10
     */
11
    private $status;
12
13
    /**
14
     * @var array
15
     */
16
    private $input;
17
18
    /**
19
     * @var array
20
     */
21
    private $output;
22
23
    /**
24
     * @var array
25
     */
26
    private $messages;
27
28
    /**
29
     * @inheritDoc
30
     */
31 7
    public function withStatus($code)
32
    {
33 7
        $copy = clone $this;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
34 7
        $copy->status = $code;
35
36 7
        return $copy;
37
    }
38
39
    /**
40
     * @inheritDoc
41
     */
42 7
    public function getStatus()
43
    {
44 7
        return $this->status;
45
    }
46
47
    /**
48
     * @inheritDoc
49
     */
50 1
    public function withInput(array $input)
51
    {
52 1
        $copy = clone $this;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
53 1
        $copy->input = $input;
54
55 1
        return $copy;
56
    }
57
58
    /**
59
     * @inheritDoc
60
     */
61 1
    public function getInput()
62
    {
63 1
        return $this->input;
64
    }
65
66
    /**
67
     * @inheritDoc
68
     */
69 5
    public function withOutput(array $output)
70
    {
71 5
        $copy = clone $this;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
72 5
        $copy->output = $output;
73
74 5
        return $copy;
75
    }
76
77
    /**
78
     * @inheritDoc
79
     */
80 6
    public function getOutput()
81
    {
82 6
        return $this->output;
83
    }
84
85
    /**
86
     * @inheritDoc
87
     */
88 2
    public function withMessages(array $messages)
89
    {
90 2
        $copy = clone $this;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
91 2
        $copy->messages = $messages;
92
93 2
        return $copy;
94
    }
95
96
    /**
97
     * @inheritDoc
98
     */
99 4
    public function getMessages()
100
    {
101 4
        return $this->messages;
102
    }
103
}
104