Completed
Push — 1.0 ( 3cba8a...ca5b13 )
by David
04:07
created
src/Objects/Binding.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 namespace Mouf\AmqpClient\Objects;
3 3
 
4 4
 use Mouf\AmqpClient\RabbitMqObjectInterface;
5
-use PhpAmqpLib\Connection\AMQPStreamConnection;
6 5
 use PhpAmqpLib\Channel\AMQPChannel;
7 6
 
8 7
 class Binding implements RabbitMqObjectInterface{
Please login to merge, or discard this patch.
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -7,144 +7,144 @@
 block discarded – undo
7 7
 
8 8
 class Binding implements RabbitMqObjectInterface{
9 9
 	
10
-	/**
11
-	 * 
12
-	 * @var Exchange
13
-	 */
14
-	private $source;
15
-	
16
-	/**
17
-	 * Routing key
18
-	 * @var string
19
-	 */
20
-	private $routing_key = '';
21
-	
22
-	/**
23
-	 * No wait
24
-	 * @var bool
25
-	 */
26
-	private $nowait = false;
27
-	
28
-	/**
29
-	 * Arguments
30
-	 * @var array
31
-	 */
32
-	private $arguments = null;
33
-	
34
-	/**
35
-	 * Ticket
36
-	 * @var int
37
-	 */
38
-	private $ticket = 0;
39
-	
40
-	/**
41
-	 *
42
-	 * @var Queue
43
-	 */
44
-	private $to;
45
-	
46
-	/**
47
-	 * Parameter to initialize object only one time
48
-	 * @var bool
49
-	 */
50
-	private $init = false;
51
-	
52
-	/**
53
-	 * Set the source (Exchange) to the destination (Queue)
54
-	 * @param Exchange $source
55
-	 * @param Queue $to
56
-	 */
57
-	public function __contruct(Exchange $source, Queue $to) {
58
-		$this->source = $source;
59
-		$this->to = $to;
60
-	}
61
-	
62
-	public function init(AMQPChannel $amqpChannel) {
63
-		if(!$this->init) {
64
-			$this->source->init();
65
-			$this->to->init();
10
+    /**
11
+     * 
12
+     * @var Exchange
13
+     */
14
+    private $source;
15
+	
16
+    /**
17
+     * Routing key
18
+     * @var string
19
+     */
20
+    private $routing_key = '';
21
+	
22
+    /**
23
+     * No wait
24
+     * @var bool
25
+     */
26
+    private $nowait = false;
27
+	
28
+    /**
29
+     * Arguments
30
+     * @var array
31
+     */
32
+    private $arguments = null;
33
+	
34
+    /**
35
+     * Ticket
36
+     * @var int
37
+     */
38
+    private $ticket = 0;
39
+	
40
+    /**
41
+     *
42
+     * @var Queue
43
+     */
44
+    private $to;
45
+	
46
+    /**
47
+     * Parameter to initialize object only one time
48
+     * @var bool
49
+     */
50
+    private $init = false;
51
+	
52
+    /**
53
+     * Set the source (Exchange) to the destination (Queue)
54
+     * @param Exchange $source
55
+     * @param Queue $to
56
+     */
57
+    public function __contruct(Exchange $source, Queue $to) {
58
+        $this->source = $source;
59
+        $this->to = $to;
60
+    }
61
+	
62
+    public function init(AMQPChannel $amqpChannel) {
63
+        if(!$this->init) {
64
+            $this->source->init();
65
+            $this->to->init();
66 66
 			
67
-			$amqpChannel->queue_bind($this->to->getName(),
68
-										$this->source->getName(),
69
-										$this->routing_key,
70
-										$this->nowait,
71
-										$this->arguments,
72
-										$this->ticket);
67
+            $amqpChannel->queue_bind($this->to->getName(),
68
+                                        $this->source->getName(),
69
+                                        $this->routing_key,
70
+                                        $this->nowait,
71
+                                        $this->arguments,
72
+                                        $this->ticket);
73 73
 			
74
-			$this->init = true;
75
-		}
76
-	}
77
-	
78
-	/**
79
-	 * Get Routing key
80
-	 * @return string
81
-	 */
82
-	public function getRoutingKey() {
83
-		return $this->routing_key;
84
-	}
85
-	
86
-	/**
87
-	 * Set routing key
88
-	 * @param string $routing_key
89
-	 * @return Binding
90
-	 */
91
-	public function setRoutingKey($routing_key) {
92
-		$this->routing_key = $routing_key;
93
-		return $this;
94
-	}
95
-	
96
-	/**
97
-	 * Get nowait
98
-	 * @return bool
99
-	 */
100
-	public function getNowait() {
101
-		return $this->nowait;
102
-	}
103
-	
104
-	/**
105
-	 * Set nowait
106
-	 * @param bool $nowait
107
-	 * @return Binding
108
-	 */
109
-	public function setNowait($nowait) {
110
-		$this->nowait = $nowait;
111
-		return $this;
112
-	}
113
-	
114
-	/**
115
-	 * Get arguments
116
-	 * @return array
117
-	 */
118
-	public function getArguments() {
119
-		return $this->arguments;
120
-	}
121
-	
122
-	/**
123
-	 * Set arguments
124
-	 * @param bool $arguments
125
-	 * @return Binding
126
-	 */
127
-	public function setArguments(array $arguments) {
128
-		$this->arguments = $arguments;
129
-		return $this;
130
-	}
131
-	
132
-	/**
133
-	 * Get ticket
134
-	 * @return int
135
-	 */
136
-	public function getTicket() {
137
-		return $this->ticket;
138
-	}
139
-	
140
-	/**
141
-	 * Set ticket
142
-	 * @param int $ticket
143
-	 * @return Binding
144
-	 */
145
-	public function setTicket($ticket) {
146
-		$this->ticket = $ticket;
147
-		return $this;
148
-	}
74
+            $this->init = true;
75
+        }
76
+    }
77
+	
78
+    /**
79
+     * Get Routing key
80
+     * @return string
81
+     */
82
+    public function getRoutingKey() {
83
+        return $this->routing_key;
84
+    }
85
+	
86
+    /**
87
+     * Set routing key
88
+     * @param string $routing_key
89
+     * @return Binding
90
+     */
91
+    public function setRoutingKey($routing_key) {
92
+        $this->routing_key = $routing_key;
93
+        return $this;
94
+    }
95
+	
96
+    /**
97
+     * Get nowait
98
+     * @return bool
99
+     */
100
+    public function getNowait() {
101
+        return $this->nowait;
102
+    }
103
+	
104
+    /**
105
+     * Set nowait
106
+     * @param bool $nowait
107
+     * @return Binding
108
+     */
109
+    public function setNowait($nowait) {
110
+        $this->nowait = $nowait;
111
+        return $this;
112
+    }
113
+	
114
+    /**
115
+     * Get arguments
116
+     * @return array
117
+     */
118
+    public function getArguments() {
119
+        return $this->arguments;
120
+    }
121
+	
122
+    /**
123
+     * Set arguments
124
+     * @param bool $arguments
125
+     * @return Binding
126
+     */
127
+    public function setArguments(array $arguments) {
128
+        $this->arguments = $arguments;
129
+        return $this;
130
+    }
131
+	
132
+    /**
133
+     * Get ticket
134
+     * @return int
135
+     */
136
+    public function getTicket() {
137
+        return $this->ticket;
138
+    }
139
+	
140
+    /**
141
+     * Set ticket
142
+     * @param int $ticket
143
+     * @return Binding
144
+     */
145
+    public function setTicket($ticket) {
146
+        $this->ticket = $ticket;
147
+        return $this;
148
+    }
149 149
 	
150 150
 }
151 151
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use PhpAmqpLib\Connection\AMQPStreamConnection;
6 6
 use PhpAmqpLib\Channel\AMQPChannel;
7 7
 
8
-class Binding implements RabbitMqObjectInterface{
8
+class Binding implements RabbitMqObjectInterface {
9 9
 	
10 10
 	/**
11 11
 	 * 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 	
62 62
 	public function init(AMQPChannel $amqpChannel) {
63
-		if(!$this->init) {
63
+		if (!$this->init) {
64 64
 			$this->source->init();
65 65
 			$this->to->init();
66 66
 			
Please login to merge, or discard this patch.
src/Objects/Exchange.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,6 @@
 block discarded – undo
75 75
 	
76 76
 	/**
77 77
 	 * Set the to (Binding)
78
-	 * @param Binding $to
79 78
 	 * @param string $name
80 79
 	 * @param string $type direct, topic, headers or fanout
81 80
 	 */
Please login to merge, or discard this patch.
Indentation   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -8,238 +8,238 @@
 block discarded – undo
8 8
 
9 9
 class Exchange implements RabbitMqObjectInterface{
10 10
 
11
-	/**
12
-	 * @var Client
13
-	 */
14
-	private $client;
11
+    /**
12
+     * @var Client
13
+     */
14
+    private $client;
15 15
 
16
-	/**
17
-	 * Name
18
-	 * @var string
19
-	 */
20
-	private $name;
21
-	
22
-	/**
23
-	 * Type direct, topic, headers or fanout
24
-	 * @var string
25
-	 */
26
-	private $type;
27
-	
28
-	/**
29
-	 * Passive
30
-	 * @var bool
31
-	 */
32
-	private $passive = false;
33
-	
34
-	/**
35
-	 * Durable
36
-	 * @var bool
37
-	 */
38
-	private $durable = false;
39
-	
40
-	/**
41
-	 * Auto delete
42
-	 * @var bool
43
-	 */
44
-	private $autoDelete = false;
45
-	
46
-	/**
47
-	 * Internal
48
-	 * @var bool
49
-	 */
50
-	private $internal = falsel;
51
-	
52
-	/**
53
-	 * No wait
54
-	 * @var bool
55
-	 */
56
-	private $nowait = false;
57
-	
58
-	/**
59
-	 * Arguments
60
-	 * @var array
61
-	 */
62
-	private $arguments = null;
63
-	
64
-	/**
65
-	 * Ticket
66
-	 * @var int
67
-	 */
68
-	private $ticket = null;
69
-	
70
-	/**
71
-	 * Parameter to initialize object only one time
72
-	 * @var bool
73
-	 */
74
-	private $init = false;
75
-	
76
-	/**
77
-	 * Set the to (Binding)
78
-	 * @param Binding $to
79
-	 * @param string $name
80
-	 * @param string $type direct, topic, headers or fanout
81
-	 */
82
-	public function __construct(Client $client, $name, $type) {
83
-		$this->client = $client;
84
-		$this->name = $name;
85
-		$this->type = $type;
86
-	}
16
+    /**
17
+     * Name
18
+     * @var string
19
+     */
20
+    private $name;
21
+	
22
+    /**
23
+     * Type direct, topic, headers or fanout
24
+     * @var string
25
+     */
26
+    private $type;
27
+	
28
+    /**
29
+     * Passive
30
+     * @var bool
31
+     */
32
+    private $passive = false;
33
+	
34
+    /**
35
+     * Durable
36
+     * @var bool
37
+     */
38
+    private $durable = false;
39
+	
40
+    /**
41
+     * Auto delete
42
+     * @var bool
43
+     */
44
+    private $autoDelete = false;
45
+	
46
+    /**
47
+     * Internal
48
+     * @var bool
49
+     */
50
+    private $internal = falsel;
51
+	
52
+    /**
53
+     * No wait
54
+     * @var bool
55
+     */
56
+    private $nowait = false;
57
+	
58
+    /**
59
+     * Arguments
60
+     * @var array
61
+     */
62
+    private $arguments = null;
63
+	
64
+    /**
65
+     * Ticket
66
+     * @var int
67
+     */
68
+    private $ticket = null;
69
+	
70
+    /**
71
+     * Parameter to initialize object only one time
72
+     * @var bool
73
+     */
74
+    private $init = false;
75
+	
76
+    /**
77
+     * Set the to (Binding)
78
+     * @param Binding $to
79
+     * @param string $name
80
+     * @param string $type direct, topic, headers or fanout
81
+     */
82
+    public function __construct(Client $client, $name, $type) {
83
+        $this->client = $client;
84
+        $this->name = $name;
85
+        $this->type = $type;
86
+    }
87 87
 
88
-	/**
89
-	 * Get the exchange name
90
-	 * @return string
91
-	 */
92
-	public function getName() {
93
-		return $this->name;
94
-	}
95
-	
96
-	/**
97
-	 * Get passive
98
-	 * @return bool
99
-	 */
100
-	public function getPassive() {
101
-		return $this->passive;
102
-	}
103
-	
104
-	/**
105
-	 * Set passive
106
-	 * @param bool $passive
107
-	 * @return Exchange
108
-	 */
109
-	public function setPassive($passive) {
110
-		$this->passive = $passive;
111
-		return $this;
112
-	}
88
+    /**
89
+     * Get the exchange name
90
+     * @return string
91
+     */
92
+    public function getName() {
93
+        return $this->name;
94
+    }
95
+	
96
+    /**
97
+     * Get passive
98
+     * @return bool
99
+     */
100
+    public function getPassive() {
101
+        return $this->passive;
102
+    }
103
+	
104
+    /**
105
+     * Set passive
106
+     * @param bool $passive
107
+     * @return Exchange
108
+     */
109
+    public function setPassive($passive) {
110
+        $this->passive = $passive;
111
+        return $this;
112
+    }
113 113
 
114
-	/**
115
-	 * Get durable
116
-	 * @return bool
117
-	 */
118
-	public function getDurable() {
119
-		return $this->durable;
120
-	}
121
-	
122
-	/**
123
-	 * Set durable
124
-	 * @param bool $durable
125
-	 * @return Exchange
126
-	 */
127
-	public function setDurable($durable) {
128
-		$this->durable = $durable;
129
-		return $this;
130
-	}
114
+    /**
115
+     * Get durable
116
+     * @return bool
117
+     */
118
+    public function getDurable() {
119
+        return $this->durable;
120
+    }
121
+	
122
+    /**
123
+     * Set durable
124
+     * @param bool $durable
125
+     * @return Exchange
126
+     */
127
+    public function setDurable($durable) {
128
+        $this->durable = $durable;
129
+        return $this;
130
+    }
131 131
 
132
-	/**
133
-	 * Get autoDelete
134
-	 * @return bool
135
-	 */
136
-	public function getAutoDelete() {
137
-		return $this->autoDelete;
138
-	}
139
-	
140
-	/**
141
-	 * Set autoDelete
142
-	 * @param bool $autoDelete
143
-	 * @return Exchange
144
-	 */
145
-	public function setAutoDelete($autoDelete) {
146
-		$this->autoDelete = $autoDelete;
147
-		return $this;
148
-	}
132
+    /**
133
+     * Get autoDelete
134
+     * @return bool
135
+     */
136
+    public function getAutoDelete() {
137
+        return $this->autoDelete;
138
+    }
139
+	
140
+    /**
141
+     * Set autoDelete
142
+     * @param bool $autoDelete
143
+     * @return Exchange
144
+     */
145
+    public function setAutoDelete($autoDelete) {
146
+        $this->autoDelete = $autoDelete;
147
+        return $this;
148
+    }
149 149
 
150
-	/**
151
-	 * Get internal
152
-	 * @return bool
153
-	 */
154
-	public function getInternal() {
155
-		return $this->internal;
156
-	}
157
-	
158
-	/**
159
-	 * Set internal
160
-	 * @param bool $internal
161
-	 * @return Exchange
162
-	 */
163
-	public function setInternal($internal) {
164
-		$this->internal = $internal;
165
-		return $this;
166
-	}
150
+    /**
151
+     * Get internal
152
+     * @return bool
153
+     */
154
+    public function getInternal() {
155
+        return $this->internal;
156
+    }
157
+	
158
+    /**
159
+     * Set internal
160
+     * @param bool $internal
161
+     * @return Exchange
162
+     */
163
+    public function setInternal($internal) {
164
+        $this->internal = $internal;
165
+        return $this;
166
+    }
167 167
 
168
-	/**
169
-	 * Get nowait
170
-	 * @return bool
171
-	 */
172
-	public function getNowait() {
173
-		return $this->nowait;
174
-	}
175
-	
176
-	/**
177
-	 * Set nowait
178
-	 * @param bool $nowait
179
-	 * @return Exchange
180
-	 */
181
-	public function setNowait($nowait) {
182
-		$this->nowait = $nowait;
183
-		return $this;
184
-	}
168
+    /**
169
+     * Get nowait
170
+     * @return bool
171
+     */
172
+    public function getNowait() {
173
+        return $this->nowait;
174
+    }
175
+	
176
+    /**
177
+     * Set nowait
178
+     * @param bool $nowait
179
+     * @return Exchange
180
+     */
181
+    public function setNowait($nowait) {
182
+        $this->nowait = $nowait;
183
+        return $this;
184
+    }
185 185
 
186
-	/**
187
-	 * Get arguments
188
-	 * @return array
189
-	 */
190
-	public function getArguments() {
191
-		return $this->arguments;
192
-	}
193
-	
194
-	/**
195
-	 * Set arguments
196
-	 * @param array $arguments
197
-	 * @return Exchange
198
-	 */
199
-	public function setArguments($arguments) {
200
-		$this->arguments = $arguments;
201
-		return $this;
202
-	}
186
+    /**
187
+     * Get arguments
188
+     * @return array
189
+     */
190
+    public function getArguments() {
191
+        return $this->arguments;
192
+    }
193
+	
194
+    /**
195
+     * Set arguments
196
+     * @param array $arguments
197
+     * @return Exchange
198
+     */
199
+    public function setArguments($arguments) {
200
+        $this->arguments = $arguments;
201
+        return $this;
202
+    }
203 203
 
204
-	/**
205
-	 * Get ticket
206
-	 * @return int
207
-	 */
208
-	public function getTicket() {
209
-		return $this->ticket;
210
-	}
211
-	
212
-	/**
213
-	 * Set ticket
214
-	 * @param int $ticket
215
-	 * @return Exchange
216
-	 */
217
-	public function setTicket($ticket) {
218
-		$this->ticket = $ticket;
219
-		return $this;
220
-	}
221
-	
222
-	public function init(AMQPChannel $amqpChannel) {
223
-		if(!$this->init) {
224
-			$amqpChannel->exchange_declare($this->name,
225
-											$this->type,
226
-											$this->passive,
227
-									        $this->durable,
228
-									        $this->auto_delete,
229
-									        $this->internal,
230
-									        $this->nowait,
231
-									        $this->arguments,
232
-									        $this->ticket);
233
-			$this->init = true;
234
-		}
235
-	}
236
-	
237
-	public function publish(AMQPMessage $message, $routingKey, $mandatory = false,
238
-							$immediate = false,
239
-							$ticket = null) {
240
-		$channel = $this->client->getChannel();
204
+    /**
205
+     * Get ticket
206
+     * @return int
207
+     */
208
+    public function getTicket() {
209
+        return $this->ticket;
210
+    }
211
+	
212
+    /**
213
+     * Set ticket
214
+     * @param int $ticket
215
+     * @return Exchange
216
+     */
217
+    public function setTicket($ticket) {
218
+        $this->ticket = $ticket;
219
+        return $this;
220
+    }
221
+	
222
+    public function init(AMQPChannel $amqpChannel) {
223
+        if(!$this->init) {
224
+            $amqpChannel->exchange_declare($this->name,
225
+                                            $this->type,
226
+                                            $this->passive,
227
+                                            $this->durable,
228
+                                            $this->auto_delete,
229
+                                            $this->internal,
230
+                                            $this->nowait,
231
+                                            $this->arguments,
232
+                                            $this->ticket);
233
+            $this->init = true;
234
+        }
235
+    }
236
+	
237
+    public function publish(AMQPMessage $message, $routingKey, $mandatory = false,
238
+                            $immediate = false,
239
+                            $ticket = null) {
240
+        $channel = $this->client->getChannel();
241 241
 
242
-		$channel->basic_publish($message, $this->name, $routingKey, $mandatory, $immediate, $ticket);
243
-	}
242
+        $channel->basic_publish($message, $this->name, $routingKey, $mandatory, $immediate, $ticket);
243
+    }
244 244
 	
245 245
 }
246 246
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use PhpAmqpLib\Channel\AMQPChannel;
7 7
 use PhpAmqpLib\Message\AMQPMessage;
8 8
 
9
-class Exchange implements RabbitMqObjectInterface{
9
+class Exchange implements RabbitMqObjectInterface {
10 10
 
11 11
 	/**
12 12
 	 * @var Client
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	}
221 221
 	
222 222
 	public function init(AMQPChannel $amqpChannel) {
223
-		if(!$this->init) {
223
+		if (!$this->init) {
224 224
 			$amqpChannel->exchange_declare($this->name,
225 225
 											$this->type,
226 226
 											$this->passive,
Please login to merge, or discard this patch.
src/RabbitMqObjectInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@
 block discarded – undo
5 5
 
6 6
 interface RabbitMqObjectInterface {
7 7
 	
8
-	/**
9
-	 * Function call to initialize the objecct in RabbitMq.
10
-	 * 
11
-	 * It is the responsibility of the object implementing init to ignore several init calls (only the first one must be accounted for)
12
-	 */
13
-	public function init(AMQPChannel $amqpChannel);
8
+    /**
9
+     * Function call to initialize the objecct in RabbitMq.
10
+     * 
11
+     * It is the responsibility of the object implementing init to ignore several init calls (only the first one must be accounted for)
12
+     */
13
+    public function init(AMQPChannel $amqpChannel);
14 14
 	
15 15
 }
16 16
\ No newline at end of file
Please login to merge, or discard this patch.
src/Client.php 2 patches
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -6,155 +6,155 @@
 block discarded – undo
6 6
 
7 7
 class Client {
8 8
 	
9
-	/**
10
-	 * RabbitMq host
11
-	 * @var string
12
-	 */
13
-	private $host;
14
-	
15
-	/**
16
-	 * RabbitMq port
17
-	 * @var string
18
-	 */
19
-	private $port;
20
-	
21
-	/**
22
-	 * RabbitMq user
23
-	 * @var string
24
-	 */
25
-	private $user;
26
-	
27
-	/**
28
-	 * RabbitMq password
29
-	 * @var string
30
-	 */
31
-	private $password;
32
-	
33
-	/**
34
-	 * It's for QOS prefetch-size http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos
35
-	 * @var int
36
-	 */
37
-	private $prefetchSize = null;
38
-	
39
-	/**
40
-	 * It's for QOS prefetch-count http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos
41
-	 * @var int
42
-	 */
43
-	private $prefetchCount = null;
44
-	
45
-	/**
46
-	 * It's for QOS global http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos
47
-	 * @var int
48
-	 */
49
-	private $aGlobal = null;
50
-	
51
-	/**
52
-	 * RabbitMq connection
53
-	 * @var AMQPStreamConnection
54
-	 */
55
-	private $connection = null;
56
-	
57
-	/**
58
-	 * RabbitMq channel
59
-	 * @var \AMQPChannel
60
-	 */
61
-	private $channel = null;
62
-	
63
-	/**
64
-	 * List of RabbitMq object
65
-	 * @var RabbitMqObjectInterface
66
-	 */
67
-	private $rabbitMqObjects = [];
68
-	
69
-	public function __construct($host, $port, $user, $password) {
70
-		$this->host = $host;
71
-		$this->port = ($port !== null) ? $port : 5672;
72
-		$this->user = $user;
73
-		$this->password = $password;
74
-	}
9
+    /**
10
+     * RabbitMq host
11
+     * @var string
12
+     */
13
+    private $host;
14
+	
15
+    /**
16
+     * RabbitMq port
17
+     * @var string
18
+     */
19
+    private $port;
20
+	
21
+    /**
22
+     * RabbitMq user
23
+     * @var string
24
+     */
25
+    private $user;
26
+	
27
+    /**
28
+     * RabbitMq password
29
+     * @var string
30
+     */
31
+    private $password;
32
+	
33
+    /**
34
+     * It's for QOS prefetch-size http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos
35
+     * @var int
36
+     */
37
+    private $prefetchSize = null;
38
+	
39
+    /**
40
+     * It's for QOS prefetch-count http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos
41
+     * @var int
42
+     */
43
+    private $prefetchCount = null;
44
+	
45
+    /**
46
+     * It's for QOS global http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos
47
+     * @var int
48
+     */
49
+    private $aGlobal = null;
50
+	
51
+    /**
52
+     * RabbitMq connection
53
+     * @var AMQPStreamConnection
54
+     */
55
+    private $connection = null;
56
+	
57
+    /**
58
+     * RabbitMq channel
59
+     * @var \AMQPChannel
60
+     */
61
+    private $channel = null;
62
+	
63
+    /**
64
+     * List of RabbitMq object
65
+     * @var RabbitMqObjectInterface
66
+     */
67
+    private $rabbitMqObjects = [];
68
+	
69
+    public function __construct($host, $port, $user, $password) {
70
+        $this->host = $host;
71
+        $this->port = ($port !== null) ? $port : 5672;
72
+        $this->user = $user;
73
+        $this->password = $password;
74
+    }
75 75
 
76
-	/**
77
-	 * Get prefetch size for QOS
78
-	 */
79
-	public function getPrefetchSize() {
80
-		return $this->prefetchSize;
81
-	}
82
-	
83
-	/**
84
-	 * Set prefetch size
85
-	 * It's for QOS prefetch-size http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos
86
-	 * 
87
-	 * @param int $prefetchSize
88
-	 */
89
-	public function setPrefetchSize($prefetchSize) {
90
-		$this->prefetchSize = $prefetchSize;
91
-		return $this;
92
-	}
93
-	
94
-	/**
95
-	 * Get prefetch count for QOS
96
-	 */
97
-	public function getPrefetchCount() {
98
-		return $this->prefetchCount;
99
-	}
100
-	
101
-	/**
102
-	 * Set prefetch size
103
-	 * It's for QOS prefetch-size http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos
104
-	 * 
105
-	 * @param int $prefetchCount
106
-	 */
107
-	public function setPrefetchCount($prefetchCount) {
108
-		$this->prefetchCount = $prefetchCount;
109
-		return $this;
110
-	}
111
-	
112
-	/**
113
-	 * Get a global for QOS
114
-	 */
115
-	public function getAGlobal() {
116
-		return $this->aGlobal;
117
-	}
118
-	
119
-	/**
120
-	 * Set global
121
-	 * It's for QOS prefetch-size http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos
122
-	 * 
123
-	 * @param int $aGlobal
124
-	 */
125
-	public function setAGlobal($aGlobal) {
126
-		$this->aGlobal = $aGlobal;
127
-		return $this;
128
-	}
129
-	
130
-	/**
131
-	 * Set RabbitMq object
132
-	 * @param RabbitMqObjectInterface[] $rabbitMqObjects
133
-	 */
134
-	public function setRabbitMqObjects(array $rabbitMqObjects) {
135
-		$this->rabbitMqObjects = $rabbitMqObjects;
136
-	}
137
-	
138
-	/**
139
-	 * Connection to the RabbitMq service with AMQPStreamConnection
140
-	 *
141
-	 * @return AMQPChannel
142
-	 */
143
-	public function getChannel() {
144
-		if(!$this->connection) {
145
-			$this->connection = new AMQPStreamConnection($this->host, $this->port, $this->user, $this->password);
76
+    /**
77
+     * Get prefetch size for QOS
78
+     */
79
+    public function getPrefetchSize() {
80
+        return $this->prefetchSize;
81
+    }
82
+	
83
+    /**
84
+     * Set prefetch size
85
+     * It's for QOS prefetch-size http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos
86
+     * 
87
+     * @param int $prefetchSize
88
+     */
89
+    public function setPrefetchSize($prefetchSize) {
90
+        $this->prefetchSize = $prefetchSize;
91
+        return $this;
92
+    }
93
+	
94
+    /**
95
+     * Get prefetch count for QOS
96
+     */
97
+    public function getPrefetchCount() {
98
+        return $this->prefetchCount;
99
+    }
100
+	
101
+    /**
102
+     * Set prefetch size
103
+     * It's for QOS prefetch-size http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos
104
+     * 
105
+     * @param int $prefetchCount
106
+     */
107
+    public function setPrefetchCount($prefetchCount) {
108
+        $this->prefetchCount = $prefetchCount;
109
+        return $this;
110
+    }
111
+	
112
+    /**
113
+     * Get a global for QOS
114
+     */
115
+    public function getAGlobal() {
116
+        return $this->aGlobal;
117
+    }
118
+	
119
+    /**
120
+     * Set global
121
+     * It's for QOS prefetch-size http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos
122
+     * 
123
+     * @param int $aGlobal
124
+     */
125
+    public function setAGlobal($aGlobal) {
126
+        $this->aGlobal = $aGlobal;
127
+        return $this;
128
+    }
129
+	
130
+    /**
131
+     * Set RabbitMq object
132
+     * @param RabbitMqObjectInterface[] $rabbitMqObjects
133
+     */
134
+    public function setRabbitMqObjects(array $rabbitMqObjects) {
135
+        $this->rabbitMqObjects = $rabbitMqObjects;
136
+    }
137
+	
138
+    /**
139
+     * Connection to the RabbitMq service with AMQPStreamConnection
140
+     *
141
+     * @return AMQPChannel
142
+     */
143
+    public function getChannel() {
144
+        if(!$this->connection) {
145
+            $this->connection = new AMQPStreamConnection($this->host, $this->port, $this->user, $this->password);
146 146
 
147
-			$this->channel = $this->connection->channel();
147
+            $this->channel = $this->connection->channel();
148 148
 			
149
- 			if($this->prefetchCount !== null || $this->prefetchCount !== null || $this->aGlobal !== null) {
150
-				$this->channel->basic_qos(null, 1, null);
151
- 			}
149
+                if($this->prefetchCount !== null || $this->prefetchCount !== null || $this->aGlobal !== null) {
150
+                $this->channel->basic_qos(null, 1, null);
151
+                }
152 152
 			
153
-			foreach ($this->rabbitMqObjects as $rabbitMqObject) {
154
-				$rabbitMqObject->init($this->channel);
155
-			}
156
-		}
157
-		return $this->channel;
158
-	}
153
+            foreach ($this->rabbitMqObjects as $rabbitMqObject) {
154
+                $rabbitMqObject->init($this->channel);
155
+            }
156
+        }
157
+        return $this->channel;
158
+    }
159 159
 	
160 160
 }
161 161
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -141,12 +141,12 @@
 block discarded – undo
141 141
 	 * @return AMQPChannel
142 142
 	 */
143 143
 	public function getChannel() {
144
-		if(!$this->connection) {
144
+		if (!$this->connection) {
145 145
 			$this->connection = new AMQPStreamConnection($this->host, $this->port, $this->user, $this->password);
146 146
 
147 147
 			$this->channel = $this->connection->channel();
148 148
 			
149
- 			if($this->prefetchCount !== null || $this->prefetchCount !== null || $this->aGlobal !== null) {
149
+ 			if ($this->prefetchCount !== null || $this->prefetchCount !== null || $this->aGlobal !== null) {
150 150
 				$this->channel->basic_qos(null, 1, null);
151 151
  			}
152 152
 			
Please login to merge, or discard this patch.
src/Objects/Queue.php 2 patches
Indentation   +220 added lines, -220 removed lines patch added patch discarded remove patch
@@ -10,230 +10,230 @@
 block discarded – undo
10 10
  */
11 11
 class Queue implements RabbitMqObjectInterface{
12 12
 
13
-	/**
14
-	 * 
15
-	 * @var Binding
16
-	 */
17
-	private $source;
18
-	
19
-	/**
20
-	 * Queue
21
-	 * @var string
22
-	 */
23
-	private $queue = '';
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
-	}
13
+    /**
14
+     * 
15
+     * @var Binding
16
+     */
17
+    private $source;
18
+	
19
+    /**
20
+     * Queue
21
+     * @var string
22
+     */
23
+    private $queue = '';
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 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]));
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]));
229 229
 			
230
-			$this->init = true;
231
-		}
232
-	}
230
+            $this->init = true;
231
+        }
232
+    }
233 233
 
234 234
 
235
-	public function comsume() {
235
+    public function comsume() {
236 236
 	
237
-	}
237
+    }
238 238
 	
239 239
 }
240 240
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @author Marc
9 9
  *
10 10
  */
11
-class Queue implements RabbitMqObjectInterface{
11
+class Queue implements RabbitMqObjectInterface {
12 12
 
13 13
 	/**
14 14
 	 * 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	
222 222
 	
223 223
 	public function init(AMQPChannel $amqpChannel) {
224
-		if(!$this->init) {
224
+		if (!$this->init) {
225 225
 			$this->source->init($amqpChannel);
226 226
 			$this->deadLetterQueue->init($amqpChannel);
227 227
 			//TODO wip
Please login to merge, or discard this patch.