Skip to content
This repository was archived by the owner on Mar 9, 2024. It is now read-only.

Commit 875ecae

Browse files
oriceonbarryvdh
authored andcommitted
Laravel 5.8 support (#82)
* Laravel 5.8 support * Update readme.md
1 parent a7c2b41 commit 875ecae

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed

Diff for: composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
],
1212
"require": {
1313
"php": ">=7",
14-
"illuminate/support": "5.5.x|5.6.x|5.7.x",
15-
"illuminate/console": "5.5.x|5.6.x|5.7.x",
14+
"illuminate/support": "5.5.x|5.6.x|5.7.x|5.8.x",
15+
"illuminate/console": "5.5.x|5.6.x|5.7.x|5.8.x",
1616
"symfony/process": "^3.2|^4"
1717
},
1818
"autoload": {

Diff for: readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Laravel 5.5 Async Queue Driver
1+
# Laravel 5 Async Queue Driver
22

33
## Push a function/closure to the background.
44

Diff for: src/AsyncQueue.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function push($job, $data = '', $queue = null)
5959
* @param array $options
6060
* @return mixed
6161
*/
62-
public function pushRaw($payload, $queue = null, array $options = array())
62+
public function pushRaw($payload, $queue = null, array $options = [])
6363
{
6464
$id = parent::pushRaw($payload, $queue, $options);
6565
$this->startProcess($id);
@@ -164,23 +164,24 @@ protected function getCommand($id)
164164
protected function getPhpBinary()
165165
{
166166
$path = $this->binary;
167-
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
167+
if ( ! defined('PHP_WINDOWS_VERSION_BUILD')) {
168168
$path = escapeshellarg($path);
169169
}
170170

171171
$args = $this->binaryArgs;
172-
if(is_array($args)){
172+
if (is_array($args)) {
173173
$args = implode(' ', $args);
174174
}
175-
return trim($path.' '.$args);
175+
176+
return trim($path . ' ' . $args);
176177
}
177178

178179
protected function getBackgroundCommand($cmd)
179180
{
180181
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
181-
return 'start /B '.$cmd.' > NUL';
182-
} else {
183-
return $cmd.' > /dev/null 2>&1 &';
182+
return 'start /B ' . $cmd . ' > NUL';
184183
}
184+
185+
return $cmd . ' > /dev/null 2>&1 &';
185186
}
186187
}

Diff for: src/AsyncServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ protected function registerAsyncConnector($manager)
7171
*/
7272
public function provides()
7373
{
74-
return array('command.queue.async');
74+
return ['command.queue.async'];
7575
}
7676
}

Diff for: src/Connectors/AsyncConnector.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Barryvdh\Queue\AsyncQueue;
66
use Illuminate\Queue\Connectors\DatabaseConnector;
7+
use Illuminate\Support\Arr;
78

89
class AsyncConnector extends DatabaseConnector
910
{
@@ -18,13 +19,13 @@ class AsyncConnector extends DatabaseConnector
1819
public function connect(array $config)
1920
{
2021
return new AsyncQueue(
21-
$this->connections->connection(array_get($config, 'connection')),
22+
$this->connections->connection(Arr::get($config, 'connection')),
2223
$config['table'],
2324
$config['queue'],
24-
array_get($config, 'expire', 60),
25-
array_get($config, 'binary', 'php'),
26-
array_get($config, 'binary_args', ''),
27-
array_get($config, 'connection_name', '')
25+
Arr::get($config, 'expire', 60),
26+
Arr::get($config, 'binary', 'php'),
27+
Arr::get($config, 'binary_args', ''),
28+
Arr::get($config, 'connection_name', '')
2829
);
2930
}
3031
}

Diff for: src/Console/AsyncCommand.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
use Barryvdh\Queue\AsyncQueue;
66
use Illuminate\Console\Command;
7-
use Illuminate\Queue\DatabaseQueue;
87
use Illuminate\Queue\Worker;
98
use Illuminate\Queue\WorkerOptions;
109
use Symfony\Component\Console\Input\InputArgument;
11-
use Symfony\Component\Console\Input\InputOption;
1210

1311
class AsyncCommand extends Command
1412
{
@@ -63,9 +61,12 @@ public function handle(WorkerOptions $options)
6361

6462
/**
6563
* Process the job
64+
*
6665
* @param string $connectionName
6766
* @param integer $id
6867
* @param WorkerOptions $options
68+
*
69+
* @throws \Throwable
6970
*/
7071
protected function processJob($connectionName, $id, $options)
7172
{
@@ -90,9 +91,9 @@ protected function processJob($connectionName, $id, $options)
9091
*/
9192
protected function getArguments()
9293
{
93-
return array(
94-
array('id', InputArgument::REQUIRED, 'The Job ID'),
95-
array('connection', InputArgument::OPTIONAL, 'The name of connection'),
96-
);
94+
return [
95+
['id', InputArgument::REQUIRED, 'The Job ID'],
96+
['connection', InputArgument::OPTIONAL, 'The name of connection'],
97+
];
9798
}
9899
}

0 commit comments

Comments
 (0)