Completed
Push — master ( ba7b2b...21cd4a )
by Woody
04:45
created

Payload::getSettings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Equip;
4
5
use Equip\Adr\PayloadInterface;
6
7
class Payload implements PayloadInterface
8
{
9
    /**
10
     * @var string
11
     */
12
    private $status;
13
14
    /**
15
     * @var array
16
     */
17
    private $input = [];
18
19
    /**
20
     * @var array
21
     */
22
    private $output = [];
23
24
    /**
25
     * @var array
26
     */
27
    private $messages = [];
28
29
    /**
30
     * @var array
31
     */
32
    private $settings = [];
33
34
    /**
35
     * @inheritDoc
36
     */
37 3
    public function withStatus($status)
38
    {
39 3
        $copy = clone $this;
40 3
        $copy->status = $status;
41
42 3
        return $copy;
43
    }
44
45
    /**
46
     * @inheritDoc
47
     */
48 4
    public function getStatus()
49
    {
50 4
        return $this->status;
51
    }
52
53
    /**
54
     * @inheritDoc
55
     */
56 1
    public function withInput(array $input)
57
    {
58 1
        $copy = clone $this;
59 1
        $copy->input = $input;
60
61 1
        return $copy;
62
    }
63
64
    /**
65
     * @inheritDoc
66
     */
67 1
    public function getInput()
68
    {
69 1
        return $this->input;
70
    }
71
72
    /**
73
     * @inheritDoc
74
     */
75 4
    public function withOutput(array $output)
76
    {
77 4
        $copy = clone $this;
78 4
        $copy->output = $output;
79
80 4
        return $copy;
81
    }
82
83
    /**
84
     * @inheritDoc
85
     */
86 5
    public function getOutput()
87
    {
88 5
        return $this->output;
89
    }
90
91
    /**
92
     * @inheritDoc
93
     */
94 1
    public function withMessages(array $messages)
95
    {
96 1
        $copy = clone $this;
97 1
        $copy->messages = $messages;
98
99 1
        return $copy;
100
    }
101
102
    /**
103
     * @inheritDoc
104
     */
105 1
    public function getMessages()
106
    {
107 1
        return $this->messages;
108
    }
109
110
    /**
111
     * @inheritDoc
112
     */
113 2
    public function withSetting($name, $value)
114
    {
115 2
        $copy = clone $this;
116 2
        $copy->settings[$name] = $value;
117
118 2
        return $copy;
119
    }
120
121
    /**
122
     * @inheritDoc
123
     */
124 1
    public function withoutSetting($name)
125
    {
126 1
        $copy = clone $this;
127 1
        unset($copy->settings[$name]);
128
129 1
        return $copy;
130
    }
131
132
    /**
133
     * @inheritDoc
134
     */
135 4
    public function getSetting($name)
136
    {
137 4
        if (isset($this->settings[$name])) {
138 2
            return $this->settings[$name];
139
        }
140
141 3
        return null;
142
    }
143
144
    /**
145
     * @inheritDoc
146
     */
147 1
    public function getSettings()
148
    {
149 1
        return $this->settings;
150
    }
151
}
152