Skip to content

Commit

Permalink
formatting and method name change
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jul 8, 2017
1 parent ab7c826 commit efe616c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Illuminate/Events/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,24 +430,26 @@ protected function createQueuedHandlerCallable($class, $method)
return is_object($a) ? clone $a : $a;
}, func_get_args());

if ($this->mayQueueHandler($class, $arguments)) {
if ($this->handlerWantsToBeQueued($class, $arguments)) {
$this->queueHandler($class, $method, $arguments);
}
};
}

/**
* Determine if the event handler may be pushed to queue.
* Determine if the event handler wants to be queued.
*
* @param string $class
* @param array $arguments
* @return bool
*/
protected function mayQueueHandler($class, $arguments)
protected function handlerWantsToBeQueued($class, $arguments)
{
return ! method_exists($class, 'shouldPushToQueue') ? true
: (new ReflectionClass($class))->newInstanceWithoutConstructor()
->shouldPushToQueue($arguments[0]);
if (method_exists($class, 'shouldQueue')) {
return $this->container->make($class)->shouldQueue($arguments[0]);
}

return true;
}

/**
Expand Down

0 comments on commit efe616c

Please sign in to comment.