Completed
Push — 1.0 ( 3cba8a...ca5b13 )
by David
04:07
created

Queue::init()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
namespace Mouf\AmqpClient\Objects;
3
4
use Mouf\AmqpClient\RabbitMqObjectInterface;
5
use PhpAmqpLib\Channel\AMQPChannel;
6
7
/**
8
 * @author Marc
9
 *
10
 */
11
class Queue implements RabbitMqObjectInterface{
12
13
	/**
14
	 * 
15
	 * @var Binding
16
	 */
17
	private $source;
18
	
19
	/**
20
	 * Queue
21
	 * @var string
22
	 */
23
	private $queue = '';
0 ignored issues
show
Unused Code introduced by
The property $queue is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
24
	
25
	/**
26
	 * Passive
27
	 * @var bool
28
	 */
29
	private $passive = false;
30
	
31
	/**
32
	 * Durable
33
	 * @var bool
34
	 */
35
	private $durable = false;
36
	
37
	/**
38
	 * Exclusive
39
	 * @var bool
40
	 */
41
	private $exclusive = false;
42
	
43
	/**
44
	 * Auto delete
45
	 * @var bool
46
	 */
47
	private $auto_delete = false;
48
	
49
	/**
50
	 * No wait
51
	 * @var bool
52
	 */
53
	private $nowait = false;
54
	
55
	/**
56
	 * Arguments
57
	 * @var null|array
58
	 */
59
	private $arguments = null;
60
	
61
	/**
62
	 * Ticket
63
	 * @var int
64
	 */
65
	private $ticket = null;
66
	
67
	/**
68
	 *
69
	 * @var Queue
70
	 */
71
	private $deadLetterQueue;
72
	
73
	/**
74
	 * Parameter to initialize object only one time
75
	 * @var bool
76
	 */
77
	private $init = false;
78
	
79
	/**
80
	 * Set the source (Binding)
81
	 * @param Binding $source
82
	 */
83
	public function __contruct(Binding $source) {
84
		$this->source = $source;
85
	}
86
	
87
	/**
88
	 * Set the dead letter queue
89
	 * @param Queue $queue
90
	 */
91
	public function setDeadLetterQueue(Queue $queue) {
92
		$this->deadLetterQueue = $queue;
93
	}
94
95
	/**
96
	 * Get passive
97
	 * @return bool
98
	 */
99
	public function getPassive() {
100
		return $this->passive;
101
	}
102
	
103
	/**
104
	 *
105
	 * @param bool $passive
106
	 * @return Queue
107
	 */
108
	public function setPassive($passive) {
109
		$this->passive = $passive;
110
		return $this;
111
	}
112
	
113
	/**
114
	 * Get durable
115
	 * @return bool
116
	 */
117
	public function getDurable() {
118
		return $this->durable;
119
	}
120
	
121
	/**
122
	 * Set durable
123
	 * @param bool $durable
124
	 * @return Queue
125
	 */
126
	public function setDurable($durable) {
127
		$this->durable = $durable;
128
		return $this;
129
	}
130
	
131
	/**
132
	 * Get exclusive
133
	 * @return bool
134
	 */
135
	public function getExclusive() {
136
		return $this->exclusive;
137
	}
138
	
139
	/**
140
	 * Set exclusive
141
	 * @param bool $exclusive
142
	 * @return Queue
143
	 */
144
	public function setExclusive($exclusive) {
145
		$this->exclusive = $exclusive;
146
		return $this;
147
	}
148
	
149
	/**
150
	 * Get auto_delete
151
	 * @return bool
152
	 */
153
	public function getAutoDelete() {
154
		return $this->auto_delete;
155
	}
156
	
157
	/**
158
	 * Set auto_delete
159
	 * @param bool $auto_delete
160
	 * @return Queue
161
	 */
162
	public function setAutoDelete($auto_delete) {
163
		$this->auto_delete = $auto_delete;
164
		return $this;
165
	}
166
	
167
	/**
168
	 * Get nowait
169
	 * @return bool
170
	 */
171
	public function getNowait() {
172
		return $this->nowait;
173
	}
174
	
175
	/**
176
	 * Set nowait
177
	 * @param bool $nowait
178
	 * @return Queue
179
	 */
180
	public function setNowait($nowait) {
181
		$this->nowait = $nowait;
182
		return $this;
183
	}
184
	
185
	/**
186
	 * Get arguments
187
	 * @return array|null
188
	 */
189
	public function getArguments() {
190
		return $this->arguments;
191
	}
192
	
193
	/**
194
	 * Set arguments
195
	 * @param array $arguments
196
	 * @return Queue
197
	 */
198
	public function setArguments($arguments) {
199
		$this->arguments = $arguments;
200
		return $this;
201
	}
202
	
203
	/**
204
	 * Get ticket
205
	 * @return int
206
	 */
207
	public function getTicket() {
208
		return $this->ticket;
209
	}
210
	
211
	/**
212
	 * Set ticket
213
	 * @param int $ticket
214
	 * @return Queue
215
	 */
216
	public function setTicket($ticket) {
217
		$this->ticket = $ticket;
218
		return $this;
219
	}
220
	
221
	
222
	
223
	public function init(AMQPChannel $amqpChannel) {
224
		if(!$this->init) {
225
			$this->source->init($amqpChannel);
226
			$this->deadLetterQueue->init($amqpChannel);
227
			//TODO wip
228
			//$amqpChannel->queue_declare($this->name, false, true, false, false, false, array('x-dead-letter-exchange' => array('S', $this->exchanger), 'x-max-priority' => ['I', $this->exchanger]));
0 ignored issues
show
Unused Code Comprehensibility introduced by
68% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
229
			
230
			$this->init = true;
231
		}
232
	}
233
234
235
	public function comsume() {
236
	
237
	}
238
	
239
}