From a3c03c4ac2d9398e591dfad53d95c1c1756edcd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Proch=C3=A1zka?= Date: Sat, 13 May 2017 03:43:28 +0200 Subject: [PATCH] refactoring --- src/Kdyby/Events/EventManager.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Kdyby/Events/EventManager.php b/src/Kdyby/Events/EventManager.php index 771285e..3db0997 100644 --- a/src/Kdyby/Events/EventManager.php +++ b/src/Kdyby/Events/EventManager.php @@ -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; @@ -224,7 +225,7 @@ public function removeEventListener($unsubscribe, $subscriber = NULL) break; } - if (!isset($key)) { + if ($key === null) { continue; } @@ -240,8 +241,6 @@ public function removeEventListener($unsubscribe, $subscriber = NULL) // otherwise it needs to be sorted again unset($this->sorted[$eventName]); } - - unset($key); } } }