Skip to content

Commit 95da24c

Browse files
committed
fix rebase namespace
1 parent d58390d commit 95da24c

File tree

1 file changed

+31
-75
lines changed

1 file changed

+31
-75
lines changed

RabbitMq/BaseAmqp.php

Lines changed: 31 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
<?php
22

33
namespace OldSound\RabbitMqBundle\RabbitMq;
4-
<<<<<<< 5818690e0890fb32c1d873645f59b33c73e3598c
5-
use OldSound\RabbitMqBundle\Event\AMQPEvent;
6-
=======
74

8-
>>>>>>> add shutdown method. When called kernel shutdown, we must close opened connection
5+
use OldSound\RabbitMqBundle\Event\AMQPEvent;
96
use PhpAmqpLib\Channel\AMQPChannel;
107
use PhpAmqpLib\Connection\AbstractConnection;
118
use PhpAmqpLib\Connection\AMQPLazyConnection;
@@ -23,35 +20,35 @@ abstract class BaseAmqp
2320
protected $queueDeclared = false;
2421
protected $routingKey = '';
2522
protected $autoSetupFabric = true;
26-
protected $basicProperties = ['content_type' => 'text/plain', 'delivery_mode' => 2];
23+
protected $basicProperties = array('content_type' => 'text/plain', 'delivery_mode' => 2);
2724

2825
/**
2926
* @var LoggerInterface
3027
*/
3128
protected $logger;
3229

33-
protected $exchangeOptions = [
34-
'passive' => false,
35-
'durable' => true,
30+
protected $exchangeOptions = array(
31+
'passive' => false,
32+
'durable' => true,
3633
'auto_delete' => false,
37-
'internal' => false,
38-
'nowait' => false,
39-
'arguments' => null,
40-
'ticket' => null,
41-
'declare' => true,
42-
];
43-
44-
protected $queueOptions = [
45-
'name' => '',
46-
'passive' => false,
47-
'durable' => true,
48-
'exclusive' => false,
34+
'internal' => false,
35+
'nowait' => false,
36+
'arguments' => null,
37+
'ticket' => null,
38+
'declare' => true,
39+
);
40+
41+
protected $queueOptions = array(
42+
'name' => '',
43+
'passive' => false,
44+
'durable' => true,
45+
'exclusive' => false,
4946
'auto_delete' => false,
50-
'nowait' => false,
51-
'arguments' => null,
52-
'ticket' => null,
53-
'declare' => true,
54-
];
47+
'nowait' => false,
48+
'arguments' => null,
49+
'ticket' => null,
50+
'declare' => true,
51+
);
5552

5653
/**
5754
* @var EventDispatcherInterface
@@ -72,11 +69,7 @@ public function __construct(AbstractConnection $conn, AMQPChannel $ch = null, $c
7269
$this->getChannel();
7370
}
7471

75-
$this->consumerTag = empty($consumerTag) ? sprintf(
76-
"PHPPROCESS_%s_%s",
77-
gethostname(),
78-
getmypid()
79-
) : $consumerTag;
72+
$this->consumerTag = empty($consumerTag) ? sprintf("PHPPROCESS_%s_%s", gethostname(), getmypid()) : $consumerTag;
8073

8174
$this->logger = new NullLogger();
8275
}
@@ -138,12 +131,10 @@ public function setChannel(AMQPChannel $ch)
138131

139132
/**
140133
* @throws \InvalidArgumentException
141-
*
142-
* @param array $options
143-
*
134+
* @param array $options
144135
* @return void
145136
*/
146-
public function setExchangeOptions(array $options = [])
137+
public function setExchangeOptions(array $options = array())
147138
{
148139
if (!isset($options['name'])) {
149140
throw new \InvalidArgumentException('You must provide an exchange name');
@@ -158,17 +149,15 @@ public function setExchangeOptions(array $options = [])
158149

159150
/**
160151
* @param array $options
161-
*
162152
* @return void
163153
*/
164-
public function setQueueOptions(array $options = [])
154+
public function setQueueOptions(array $options = array())
165155
{
166156
$this->queueOptions = array_merge($this->queueOptions, $options);
167157
}
168158

169159
/**
170160
* @param string $routingKey
171-
*
172161
* @return void
173162
*/
174163
public function setRoutingKey($routingKey)
@@ -218,8 +207,7 @@ protected function exchangeDeclare()
218207
$this->exchangeOptions['internal'],
219208
$this->exchangeOptions['nowait'],
220209
$this->exchangeOptions['arguments'],
221-
$this->exchangeOptions['ticket']
222-
);
210+
$this->exchangeOptions['ticket']);
223211

224212
$this->exchangeDeclared = true;
225213
}
@@ -231,16 +219,10 @@ protected function exchangeDeclare()
231219
protected function queueDeclare()
232220
{
233221
if ($this->queueOptions['declare']) {
234-
list($queueName, ,) = $this->getChannel()->queue_declare(
235-
$this->queueOptions['name'],
236-
$this->queueOptions['passive'],
237-
$this->queueOptions['durable'],
238-
$this->queueOptions['exclusive'],
239-
$this->queueOptions['auto_delete'],
240-
$this->queueOptions['nowait'],
241-
$this->queueOptions['arguments'],
242-
$this->queueOptions['ticket']
243-
);
222+
list($queueName, ,) = $this->getChannel()->queue_declare($this->queueOptions['name'], $this->queueOptions['passive'],
223+
$this->queueOptions['durable'], $this->queueOptions['exclusive'],
224+
$this->queueOptions['auto_delete'], $this->queueOptions['nowait'],
225+
$this->queueOptions['arguments'], $this->queueOptions['ticket']);
244226

245227
if (isset($this->queueOptions['routing_keys']) && count($this->queueOptions['routing_keys']) > 0) {
246228
foreach ($this->queueOptions['routing_keys'] as $routingKey) {
@@ -269,32 +251,6 @@ protected function queueBind($queue, $exchange, $routing_key)
269251
}
270252
}
271253

272-
public function setupFabric()
273-
{
274-
if (!$this->exchangeDeclared) {
275-
$this->exchangeDeclare();
276-
}
277-
278-
if (!$this->queueDeclared) {
279-
$this->queueDeclare();
280-
}
281-
}
282-
283-
/**
284-
* disables the automatic SetupFabric when using a consumer or producer
285-
*/
286-
public function disableAutoSetupFabric() {
287-
$this->autoSetupFabric = false;
288-
}
289-
290-
/**
291-
* @param LoggerInterface $logger
292-
*/
293-
public function setLogger($logger)
294-
{
295-
$this->logger = $logger;
296-
}
297-
298254
/**
299255
* @param EventDispatcherInterface $eventDispatcher
300256
*

0 commit comments

Comments
 (0)