Skip to content
This repository was archived by the owner on Sep 3, 2020. It is now read-only.

Commit 9f5ed92

Browse files
authored
Merge pull request vyuldashev#77 from vladimir-yuldashev/analysis-ze6D0K
Applied fixes from StyleCI
2 parents 86e2a9b + 4aa8b51 commit 9f5ed92

File tree

6 files changed

+32
-38
lines changed

6 files changed

+32
-38
lines changed

src/VladimirYuldashev/LaravelQueueRabbitMQ/LaravelQueueRabbitMQServiceProvider.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
class LaravelQueueRabbitMQServiceProvider extends ServiceProvider
99
{
10-
1110
/**
1211
* Register the service provider.
1312
*
@@ -28,12 +27,11 @@ public function register()
2827
public function boot()
2928
{
3029
/**
31-
* @var \Illuminate\Queue\QueueManager $manager
30+
* @var \Illuminate\Queue\QueueManager
3231
*/
3332
$manager = $this->app['queue'];
3433
$manager->addConnector('rabbitmq', function () {
3534
return new RabbitMQConnector;
3635
});
3736
}
38-
39-
}
37+
}

src/VladimirYuldashev/LaravelQueueRabbitMQ/Queue/Connectors/RabbitMQConnector.php

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,22 @@
88

99
class RabbitMQConnector implements ConnectorInterface
1010
{
11+
/**
12+
* Establish a queue connection.
13+
*
14+
* @param array $config
15+
*
16+
* @return \Illuminate\Contracts\Queue\Queue
17+
*/
18+
public function connect(array $config)
19+
{
20+
// create connection with AMQP
21+
$connection = new AMQPStreamConnection($config['host'], $config['port'], $config['login'], $config['password'],
22+
$config['vhost']);
1123

12-
/**
13-
* Establish a queue connection.
14-
*
15-
* @param array $config
16-
*
17-
* @return \Illuminate\Contracts\Queue\Queue
18-
*/
19-
public function connect(array $config)
20-
{
21-
// create connection with AMQP
22-
$connection = new AMQPStreamConnection($config['host'], $config['port'], $config['login'], $config['password'],
23-
$config['vhost']);
24-
25-
return new RabbitMQQueue(
26-
$connection,
27-
$config
28-
);
29-
}
30-
31-
}
24+
return new RabbitMQQueue(
25+
$connection,
26+
$config
27+
);
28+
}
29+
}

src/VladimirYuldashev/LaravelQueueRabbitMQ/Queue/Jobs/RabbitMQJob.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class RabbitMQJob extends Job implements JobContract
1313
{
1414
/**
15-
* Same as RabbitMQQueue, used for attempt counts
15+
* Same as RabbitMQQueue, used for attempt counts.
1616
*/
1717
const ATTEMPT_COUNT_HEADERS_KEY = 'attempts_count';
1818

@@ -29,7 +29,6 @@ class RabbitMQJob extends Job implements JobContract
2929
* @param PhpAmqpLib\Channel\AMQPChannel $channel
3030
* @param string $queue
3131
* @param PhpAmqpLib\Message\AMQPMessage $message
32-
*
3332
*/
3433
public function __construct(
3534
Container $container,
@@ -110,7 +109,7 @@ public function release($delay = 0)
110109

111110
$body = $this->getParsedBody();
112111

113-
/**
112+
/*
114113
* Some jobs don't have the command set, so fall back to just sending it the job name string
115114
*/
116115
if (isset($body['data']['command']) === true) {
@@ -142,6 +141,7 @@ public function attempts()
142141
return $headers[self::ATTEMPT_COUNT_HEADERS_KEY];
143142
}
144143
}
144+
145145
return 0;
146146
}
147147

src/VladimirYuldashev/LaravelQueueRabbitMQ/Queue/RabbitMQQueue.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class RabbitMQQueue extends Queue implements QueueContract
1515
{
1616
/**
17-
* Used for retry logic, to set the retries on the message metadata instead of the message body
17+
* Used for retry logic, to set the retries on the message metadata instead of the message body.
1818
*/
1919
const ATTEMPT_COUNT_HEADERS_KEY = 'attempts_count';
2020

@@ -143,8 +143,6 @@ public function pop($queue = null)
143143
if ($message instanceof AMQPMessage) {
144144
return new RabbitMQJob($this->container, $this, $this->channel, $queue, $message);
145145
}
146-
147-
return null;
148146
}
149147

150148
/**
@@ -213,7 +211,7 @@ private function declareDelayedQueue($destination, $delay)
213211
$delay = $this->getSeconds($delay);
214212
$destination = $this->getQueueName($destination);
215213
$destinationExchange = $this->configExchange['name'] ?: $destination;
216-
$name = $this->getQueueName($destination) . '_deferred_' . $delay;
214+
$name = $this->getQueueName($destination).'_deferred_'.$delay;
217215
$exchange = $this->configExchange['name'] ?: $destination;
218216

219217
// declare exchange
@@ -247,7 +245,7 @@ private function declareDelayedQueue($destination, $delay)
247245
}
248246

249247
/**
250-
* Sets the attempts member variable to be used in message generation
248+
* Sets the attempts member variable to be used in message generation.
251249
*
252250
* @param int $count
253251
*

src/config/rabbitmq.php

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

33
/**
4-
* default configuration for laravel-queue-rabbitmq merged with project config to base key 'queue'
4+
* default configuration for laravel-queue-rabbitmq merged with project config to base key 'queue'.
55
* @see \MapleSyrupGroup\AMQPEvents\Providers\AMQPEventServiceProvider
66
*/
77
return [
@@ -34,4 +34,4 @@
3434
'auto_delete' => env('RABBITMQ_EXCHANGE_AUTODELETE', false),
3535
],
3636

37-
];
37+
];

src/examples/app.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
return [
44

5-
'providers' => append_config([
6-
VladimirYuldashev\LaravelQueueRabbitMQ\LaravelQueueRabbitMQServiceProvider::class,
7-
]),
5+
'providers' => append_config([
6+
VladimirYuldashev\LaravelQueueRabbitMQ\LaravelQueueRabbitMQServiceProvider::class,
7+
]),
88

9-
];
9+
];

0 commit comments

Comments
 (0)