浏览代码

[EventDispatcher] simplified code (thanks Kris Wallsmith for the tip)

Fabien Potencier 14 年之前
父节点
当前提交
93fc26d869
共有 1 个文件被更改,包括 2 次插入7 次删除
  1. 2 7
      src/Symfony/Component/EventDispatcher/EventDispatcher.php

+ 2 - 7
src/Symfony/Component/EventDispatcher/EventDispatcher.php

@@ -140,13 +140,8 @@ class EventDispatcher implements EventDispatcherInterface
             return array();
             return array();
         }
         }
 
 
-        $listeners = array();
-        $all = $this->listeners[$name];
-        krsort($all);
-        foreach ($all as $l) {
-            $listeners = array_merge($listeners, $l);
-        }
+        krsort($this->listeners[$name]);
 
 
-        return $listeners;
+        return call_user_func_array('array_merge', $this->listeners[$name]);
     }
     }
 }
 }