Skip to content

Commit c80302e

Browse files
committed
formatting
1 parent 4786be9 commit c80302e

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

src/Illuminate/Events/Dispatcher.php

+18-9
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,26 @@ protected function setupWildcardListen($event, $listener)
104104
*/
105105
public function hasListeners($eventName)
106106
{
107-
$hasWildcard = function ($eventName) {
108-
foreach ($this->wildcards as $key => $listeners) {
109-
if (Str::is($key, $eventName)) {
110-
return true;
111-
}
112-
}
107+
return isset($this->listeners[$eventName]) ||
108+
isset($this->wildcards[$eventName]) ||
109+
$this->hasWildcardListeners($eventName);
110+
}
113111

114-
return false;
115-
};
112+
/**
113+
* Determine if the given event has any wildcard listeners.
114+
*
115+
* @param string $eventName
116+
* @return bool
117+
*/
118+
public function hasWildcardListeners($eventName)
119+
{
120+
foreach ($this->wildcards as $key => $listeners) {
121+
if (Str::is($key, $eventName)) {
122+
return true;
123+
}
124+
}
116125

117-
return isset($this->listeners[$eventName]) || isset($this->wildcards[$eventName]) || $hasWildcard($eventName);
126+
return false;
118127
}
119128

120129
/**

0 commit comments

Comments
 (0)