private function TraceableEventDispatcher::addCalledListener in Devel 8
Same name and namespace in other branches
- 8.3 webprofiler/src/EventDispatcher/TraceableEventDispatcher.php \Drupal\webprofiler\EventDispatcher\TraceableEventDispatcher::addCalledListener()
- 8.2 webprofiler/src/EventDispatcher/TraceableEventDispatcher.php \Drupal\webprofiler\EventDispatcher\TraceableEventDispatcher::addCalledListener()
- 4.x webprofiler/src/EventDispatcher/TraceableEventDispatcher.php \Drupal\webprofiler\EventDispatcher\TraceableEventDispatcher::addCalledListener()
Parameters
$definition:
$event_name:
$priority:
1 call to TraceableEventDispatcher::addCalledListener()
- TraceableEventDispatcher::dispatch in webprofiler/
src/ EventDispatcher/ TraceableEventDispatcher.php - Dispatches an event to all registered listeners.
File
- webprofiler/
src/ EventDispatcher/ TraceableEventDispatcher.php, line 172
Class
- TraceableEventDispatcher
- Class TraceableEventDispatcher
Namespace
Drupal\webprofiler\EventDispatcherCode
private function addCalledListener($definition, $event_name, $priority) {
if ($this
->isClosure($definition['callable'])) {
$this->calledListeners[$event_name][$priority][] = [
'class' => 'Closure',
'method' => '',
];
}
else {
$this->calledListeners[$event_name][$priority][] = [
'class' => get_class($definition['callable'][0]),
'method' => $definition['callable'][1],
];
}
foreach ($this->notCalledListeners[$event_name][$priority] as $key => $listener) {
if (isset($listener['service'])) {
if ($listener['service'][0] == $definition['service'][0] && $listener['service'][1] == $definition['service'][1]) {
unset($this->notCalledListeners[$event_name][$priority][$key]);
}
}
else {
if ($this
->isClosure($listener['callable'])) {
if (is_callable($listener['callable'], TRUE, $listenerCallableName) && is_callable($definition['callable'], TRUE, $definitionCallableName)) {
if ($listenerCallableName == $definitionCallableName) {
unset($this->notCalledListeners[$event_name][$priority][$key]);
}
}
}
else {
if (get_class($listener['callable'][0]) == get_class($definition['callable'][0]) && $listener['callable'][1] == $definition['callable'][1]) {
unset($this->notCalledListeners[$event_name][$priority][$key]);
}
}
}
}
}