[EventDispatcher] perf optim
This commit is contained in:
parent
c7cf6cfefe
commit
5af0f899fe
@ -76,21 +76,18 @@ class ContainerAwareEventDispatcher extends EventDispatcher
|
||||
{
|
||||
$this->lazyLoad($eventName);
|
||||
|
||||
if (isset($this->listeners[$eventName])) {
|
||||
foreach ($this->listeners[$eventName] as $key => $l) {
|
||||
foreach ($this->listenerIds[$eventName] as $i => $args) {
|
||||
list($serviceId, $method, $priority) = $args;
|
||||
if ($key === $serviceId.'.'.$method) {
|
||||
if ($listener === array($l, $method)) {
|
||||
unset($this->listeners[$eventName][$key]);
|
||||
if (empty($this->listeners[$eventName])) {
|
||||
unset($this->listeners[$eventName]);
|
||||
}
|
||||
unset($this->listenerIds[$eventName][$i]);
|
||||
if (empty($this->listenerIds[$eventName])) {
|
||||
unset($this->listenerIds[$eventName]);
|
||||
}
|
||||
}
|
||||
if (isset($this->listenerIds[$eventName])) {
|
||||
foreach ($this->listenerIds[$eventName] as $i => $args) {
|
||||
list($serviceId, $method, $priority) = $args;
|
||||
$key = $serviceId.'.'.$method;
|
||||
if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) {
|
||||
unset($this->listeners[$eventName][$key]);
|
||||
if (empty($this->listeners[$eventName])) {
|
||||
unset($this->listeners[$eventName]);
|
||||
}
|
||||
unset($this->listenerIds[$eventName][$i]);
|
||||
if (empty($this->listenerIds[$eventName])) {
|
||||
unset($this->listenerIds[$eventName]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -232,8 +232,6 @@ class SubscriberService implements EventSubscriberInterface
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
'onEvent' => 'onEvent',
|
||||
'onEvent' => array('onEvent', 10),
|
||||
'onEvent' => array('onEvent'),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user