Skip to content

Commit

Permalink
code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 16, 2017
1 parent 9c67b70 commit cf461e2
Showing 1 changed file with 36 additions and 12 deletions.
48 changes: 36 additions & 12 deletions src/Illuminate/Events/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,25 +450,49 @@ protected function callQueueMethodOnHandler($class, $method, $arguments)
*/
protected function queueHandler($class, $method, $arguments)
{
$listener = (new ReflectionClass($class))->newInstanceWithoutConstructor();

$job = new CallQueuedListener($class, $method, $arguments);
list($listener, $job) = $this->createListenerAndJob($class, $method, $arguments);

$connection = isset($listener->connection) ? $listener->connection : null;
$connection = $this->resolveQueue()->connection(
isset($listener->connection) ? $listener->connection : null
);

$queue = isset($listener->queue) ? $listener->queue : null;

$job->tries = isset($listener->tries) ? $listener->tries : null;
isset($listener->delay)
? $connection->laterOn($queue, $listener->delay, $job)
: $connection->pushOn($queue, $job);
}

$job->timeout = isset($listener->timeout) ? $listener->timeout : null;
/**
* Create the listener and job for a queued listener.
*
* @param string $class
* @param string $method
* @param array $arguments
* @return array
*/
protected function createListenerAndJob($class, $method, $arguments)
{
$listener = (new ReflectionClass($class))->newInstanceWithoutConstructor();

$resolvedQueue = $this->resolveQueue()->connection($connection);
return [$listener, $this->propogateListenerOptions(
$listener, new CallQueuedListener($class, $method, $arguments)
)];
}

if (isset($listener->delay)) {
$resolvedQueue->laterOn($queue, $listener->delay, $job);
} else {
$resolvedQueue->pushOn($queue, $job);
}
/**
* Propogate listener options to the job.
*
* @param mixed $listener
* @param mixed $job
* @return mixed
*/
protected function propogateListenerOptions($listener, $job)

This comment has been minimized.

Copy link
@abcdmitry

abcdmitry Mar 21, 2017

I think spelling should be corrected here to propagateListenerOptions

{
return tap($job, function ($job) use ($listener) {
$job->tries = isset($listener->tries) ? $listener->tries : null;
$job->timeout = isset($listener->timeout) ? $listener->timeout : null;
});
}

/**
Expand Down

0 comments on commit cf461e2

Please sign in to comment.