Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
fprochazka committed May 13, 2017
1 parent 2a7dfe4 commit a3c03c4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Kdyby/Events/EventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ public function removeEventListener($unsubscribe, $subscriber = NULL)
foreach ((array) $unsubscribe as $eventName) {
$eventName = ltrim($eventName, '\\');
foreach ($this->listeners[$eventName] as $priority => $listeners) {
$key = NULL;
foreach ($listeners as $k => $listener) {
if (!($listener == $subscriber || (is_array($listener) && $listener[0] == $subscriber))) {
continue;
Expand All @@ -224,7 +225,7 @@ public function removeEventListener($unsubscribe, $subscriber = NULL)
break;
}

if (!isset($key)) {
if ($key === null) {
continue;
}

Expand All @@ -240,8 +241,6 @@ public function removeEventListener($unsubscribe, $subscriber = NULL)
// otherwise it needs to be sorted again
unset($this->sorted[$eventName]);
}

unset($key);
}
}
}
Expand Down

0 comments on commit a3c03c4

Please sign in to comment.