Completed
Push — master ( 272ffa...4c35ad )
by Clayton
19s
created

Payload   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 114
Duplicated Lines 0 %

Coupling/Cohesion

Components 4
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 114
c 0
b 0
f 0
wmc 8
lcom 4
cbo 1
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A withStatus() 0 7 1
A getStatus() 0 4 1
A withInput() 0 7 1
A getInput() 0 4 1
A withOutput() 0 7 1
A getOutput() 0 4 1
A withMessages() 0 7 1
A getMessages() 0 4 1
1
<?php
2
3
namespace BrightComponents\Common\Payloads;
4
5
use BrightComponents\Common\Payloads\Contracts\PayloadContract;
6
7
class Payload extends PayloadContract
8
{
9
    /** @var string */
10
    private $status;
11
12
    /** @var array */
13
    private $input = [];
14
15
    /** @var array */
16
    private $output = [];
17
18
    /** @var array */
19
    private $messages = [];
20
21
    /**
22
     * Create a copy of the payload with the status.
23
     *
24
     * @param  string  $status
25
     *
26
     * @return \BrightComponents\Common\Payloads\Contracts\PayloadContract
27
     */
28
    public function withStatus($status)
29
    {
30
        $copy = clone $this;
31
        $copy->status = $status;
32
33
        return $copy;
34
    }
35
36
    /**
37
     * Get the status of the payload.
38
     *
39
     * @return string
40
     */
41
    public function getStatus()
42
    {
43
        return $this->status;
44
    }
45
46
    /**
47
     * Create a copy of the payload with input array.
48
     *
49
     * @param  array  $input
50
     *
51
     * @return \BrightComponents\Common\Payloads\Contracts\PayloadContract
52
     */
53
    public function withInput(array $input)
54
    {
55
        $copy = clone $this;
56
        $copy->input = $input;
57
58
        return $copy;
59
    }
60
61
    /**
62
     * Get input array from the payload.
63
     *
64
     * @return array
65
     */
66
    public function getInput()
67
    {
68
        return $this->input;
69
    }
70
71
    /**
72
     * Create a copy of the payload with output array.
73
     *
74
     * @param  array  $output
75
     *
76
     * @return \BrightComponents\Common\Payloads\Contracts\PayloadContract
77
     */
78
    public function withOutput(array $output)
79
    {
80
        $copy = clone $this;
81
        $copy->output = $output;
82
83
        return $copy;
84
    }
85
86
    /**
87
     * Get output array from the payload.
88
     *
89
     * @return array
90
     */
91
    public function getOutput()
92
    {
93
        return $this->output;
94
    }
95
96
    /**
97
     * Create a copy of the payload with messages array.
98
     *
99
     * @param  array  $output
0 ignored issues
show
Bug introduced by
There is no parameter named $output. 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...
100
     *
101
     * @return \BrightComponents\Common\Payloads\Contracts\PayloadContract
102
     */
103
    public function withMessages(array $messages)
104
    {
105
        $copy = clone $this;
106
        $copy->messages = $messages;
107
108
        return $copy;
109
    }
110
111
    /**
112
     * Get messages array from the payload.
113
     *
114
     * @return array
115
     */
116
    public function getMessages()
117
    {
118
        return $this->messages;
119
    }
120
}
121