From efe616cc2872ad096dd7fb1b8d6dd8e2e65ec846 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 7 Jul 2017 20:54:13 -0500 Subject: [PATCH] formatting and method name change --- src/Illuminate/Events/Dispatcher.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Events/Dispatcher.php b/src/Illuminate/Events/Dispatcher.php index a95f5f110167..acc01133f1d9 100755 --- a/src/Illuminate/Events/Dispatcher.php +++ b/src/Illuminate/Events/Dispatcher.php @@ -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; } /**