Passed
Branch master (ae28f9)
by Alexey
03:28
created

Payload   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 60.71%

Importance

Changes 0
Metric Value
wmc 6
lcom 2
cbo 0
dl 0
loc 82
ccs 17
cts 28
cp 0.6071
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getInput() 0 4 1
A getOutput() 0 4 1
A getStatus() 0 4 1
A withInput() 0 7 1
A withOutput() 0 7 1
1
<?php declare(strict_types = 1);
2
3
namespace Venta\Adr;
4
5
use Venta\Contracts\Adr\Payload as PayloadContract;
6
7
/**
8
 * Class Payload
9
 *
10
 * @package Venta\Adr
11
 */
12
class Payload implements PayloadContract
13
{
14
15
    /**
16
     * @var array
17
     */
18
    private $input = [];
19
20
    /**
21
     * @var
22
     */
23
    private $output;
24
25
    /**
26
     * @var string
27
     */
28
    private $status = '';
29
30
    /**
31
     * Payload constructor.
32
     *
33
     * @param string $status
34
     */
35 4
    public function __construct(string $status)
36
    {
37 4
        $this->status = $status;
38 4
    }
39
40
    /**
41
     * @inheritDoc
42
     */
43 2
    public function getInput(): array
44
    {
45 2
        return $this->input;
46
    }
47
48
    /**
49
     * @inheritDoc
50
     */
51 1
    public function getOutput()
52
    {
53 1
        return $this->output;
54
    }
55
56
    /**
57
     * @inheritDoc
58
     */
59 1
    public function getStatus(): string
60
    {
61 1
        return $this->status;
62
    }
63
64
    /**
65
     * Input setter.
66
     *
67
     * @param array $arguments
68
     * @return PayloadContract
69
     */
70 1
    public function withInput(array $arguments): PayloadContract
71
    {
72 1
        $payload = clone $this;
1 ignored issue
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...
73 1
        $payload->input = $arguments;
74
75 1
        return $payload;
76
    }
77
78
    /**
79
     * Output setter.
80
     *
81
     * @param $output
82
     * @return PayloadContract
83
     */
84 1
    public function withOutput($output): PayloadContract
85
    {
86 1
        $payload = clone $this;
1 ignored issue
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...
87 1
        $payload->output = $output;
88
89 1
        return $payload;
90
    }
91
92
93
}