From c80302e6e9403f9fad71f114d94e758ee0fcbff7 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 10 Feb 2020 07:48:55 -0600 Subject: [PATCH] formatting --- src/Illuminate/Events/Dispatcher.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/Illuminate/Events/Dispatcher.php b/src/Illuminate/Events/Dispatcher.php index 0b35a320c12c..21dc14ab9e88 100755 --- a/src/Illuminate/Events/Dispatcher.php +++ b/src/Illuminate/Events/Dispatcher.php @@ -104,17 +104,26 @@ protected function setupWildcardListen($event, $listener) */ public function hasListeners($eventName) { - $hasWildcard = function ($eventName) { - foreach ($this->wildcards as $key => $listeners) { - if (Str::is($key, $eventName)) { - return true; - } - } + return isset($this->listeners[$eventName]) || + isset($this->wildcards[$eventName]) || + $this->hasWildcardListeners($eventName); + } - return false; - }; + /** + * Determine if the given event has any wildcard listeners. + * + * @param string $eventName + * @return bool + */ + public function hasWildcardListeners($eventName) + { + foreach ($this->wildcards as $key => $listeners) { + if (Str::is($key, $eventName)) { + return true; + } + } - return isset($this->listeners[$eventName]) || isset($this->wildcards[$eventName]) || $hasWildcard($eventName); + return false; } /**