Exchange::setDurable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace RabbitMqModule\Options;
4
5
use Zend\Stdlib\AbstractOptions;
6
7
/**
8
 * Class Exchange
9
 * @package RabbitMqModule\Options
10
 */
11
class Exchange extends AbstractOptions
12
{
13
    /**
14
     * @var string
15
     */
16
    protected $name;
17
    /**
18
     * @var string
19
     */
20
    protected $type;
21
    /**
22
     * @var bool
23
     */
24
    protected $passive = false;
25
    /**
26
     * @var bool
27
     */
28
    protected $durable = true;
29
    /**
30
     * @var bool
31
     */
32
    protected $autoDelete = false;
33
    /**
34
     * @var bool
35
     */
36
    protected $internal = false;
37
    /**
38
     * @var bool
39
     */
40
    protected $noWait = false;
41
    /**
42
     * @var bool
43
     */
44
    protected $declare = true;
45
    /**
46
     * @var array
47
     */
48
    protected $arguments = [];
49
    /**
50
     * @var int
51
     */
52
    protected $ticket = 0;
53
    /**
54
     * @var ExchangeBind[]
55
     */
56
    protected $exchangeBinds = [];
57
58
    /**
59
     * @return string
60
     */
61 8
    public function getName()
62
    {
63 8
        return $this->name;
64
    }
65
66
    /**
67
     * @param string $name
68
     *
69
     * @return $this
70
     */
71 9
    public function setName($name)
72
    {
73 9
        $this->name = $name;
74
75 9
        return $this;
76
    }
77
78
    /**
79
     * @return string
80
     */
81 7
    public function getType()
82
    {
83 7
        return $this->type;
84
    }
85
86
    /**
87
     * @param string $type
88
     *
89
     * @return $this
90
     */
91 1
    public function setType($type)
92
    {
93 1
        $this->type = $type;
94
95 1
        return $this;
96
    }
97
98
    /**
99
     * @return bool
100
     */
101 7
    public function isPassive()
102
    {
103 7
        return $this->passive;
104
    }
105
106
    /**
107
     * @param bool $passive
108
     *
109
     * @return $this
110
     */
111 1
    public function setPassive($passive)
112
    {
113 1
        $this->passive = $passive;
114
115 1
        return $this;
116
    }
117
118
    /**
119
     * @return bool
120
     */
121 7
    public function isDurable()
122
    {
123 7
        return $this->durable;
124
    }
125
126
    /**
127
     * @param bool $durable
128
     *
129
     * @return $this
130
     */
131 1
    public function setDurable($durable)
132
    {
133 1
        $this->durable = $durable;
134
135 1
        return $this;
136
    }
137
138
    /**
139
     * @return bool
140
     */
141 7
    public function isAutoDelete()
142
    {
143 7
        return $this->autoDelete;
144
    }
145
146
    /**
147
     * @param bool $autoDelete
148
     *
149
     * @return $this
150
     */
151 1
    public function setAutoDelete($autoDelete)
152
    {
153 1
        $this->autoDelete = $autoDelete;
154
155 1
        return $this;
156
    }
157
158
    /**
159
     * @return bool
160
     */
161 7
    public function isInternal()
162
    {
163 7
        return $this->internal;
164
    }
165
166
    /**
167
     * @param bool $internal
168
     *
169
     * @return $this
170
     */
171 1
    public function setInternal($internal)
172
    {
173 1
        $this->internal = $internal;
174
175 1
        return $this;
176
    }
177
178
    /**
179
     * @return bool
180
     */
181 7
    public function isNoWait()
182
    {
183 7
        return $this->noWait;
184
    }
185
186
    /**
187
     * @param bool $noWait
188
     *
189
     * @return $this
190
     */
191 1
    public function setNoWait($noWait)
192
    {
193 1
        $this->noWait = $noWait;
194
195 1
        return $this;
196
    }
197
198
    /**
199
     * @return bool
200
     */
201 10
    public function isDeclare()
202
    {
203 10
        return $this->declare;
204
    }
205
206
    /**
207
     * @param bool $declare
208
     *
209
     * @return $this
210
     */
211 4
    public function setDeclare($declare)
212
    {
213 4
        $this->declare = $declare;
214
215 4
        return $this;
216
    }
217
218
    /**
219
     * @return array
220
     */
221 7
    public function getArguments()
222
    {
223 7
        return $this->arguments;
224
    }
225
226
    /**
227
     * @param array $arguments
228
     *
229
     * @return $this
230
     */
231 1
    public function setArguments(array $arguments)
232
    {
233 1
        $this->arguments = $arguments;
234
235 1
        return $this;
236
    }
237
238
    /**
239
     * @return int
240
     */
241 7
    public function getTicket()
242
    {
243 7
        return $this->ticket;
244
    }
245
246
    /**
247
     * @param int $ticket
248
     *
249
     * @return $this
250
     */
251 1
    public function setTicket($ticket)
252
    {
253 1
        $this->ticket = $ticket;
254
255 1
        return $this;
256
    }
257
258
    /**
259
     * @return ExchangeBind[]
260
     */
261 7
    public function getExchangeBinds()
262
    {
263 7
        return $this->exchangeBinds;
264
    }
265
266
    /**
267
     * @param array|ExchangeBind[] $exchangeBinds
268
     *
269
     * @return $this
270
     */
271 2
    public function setExchangeBinds(array $exchangeBinds)
272
    {
273 2
        $this->exchangeBinds = [];
274 2
        foreach ($exchangeBinds as $bind) {
275 2
            $this->addExchangeBind($bind);
276 2
        }
277
278 2
        return $this;
279
    }
280
281
    /**
282
     * @param array|ExchangeBind $bind
283
     *
284
     * @return $this
285
     */
286 3
    public function addExchangeBind($bind)
287
    {
288 3
        if (is_array($bind)) {
289 1
            $bind = new ExchangeBind($bind);
290 1
        }
291 3
        if (!$bind instanceof ExchangeBind) {
292 1
            throw new \InvalidArgumentException('Invalid exchange bind options');
293
        }
294 2
        $this->exchangeBinds[] = $bind;
295
296 2
        return $this;
297
    }
298
}
299