Exemple #1
0
    {
        return $this->_listeners;
    }
    /**
     * @param $listener
     * @return bool | array
     */
    public function getListener($listener)
    {
        if (isset($this->_listeners[$listener])) {
            return $this->_listeners[$listener];
        }
        return false;
    }
    private function _sortListenerByPriority($a, $b)
    {
        if ($a['priority'] == $b['priority']) {
            return 0;
        }
        return $a['priority'] < $b['priority'] ? -1 : 1;
    }
}
$em = new EventManager();
$em->on('ev', function ($a) {
    //    var_dump($a);
});
$startTime = microtime(true);
for ($i = 0; $i < 100; $i++) {
    $em->emit('ev', [1, 2, 3, 4, 5, 6]);
}
echo "Compile time: ", microtime(true) - $startTime, " seconds\n";