public function on($event, $callback, $priority = 0){

        if (is_array($event)) {

            foreach ($event as &$evt) {
                $this->on($evt, $callback, $priority);
            }
            return $this;
        }

        if (!isset($this->events[$event])) $this->events[$event] = [];

        // make $this available in closures
        if (is_object($callback) && $callback instanceof \Closure) {
            $callback = $callback->bindTo($this, $this);
        }

        $this->events[$event][] = ['fn' => $callback, 'prio' => $priority];

        return $this;
    }
public function on($event, $callback, $priority = 0){

        if (is_array($event)) {

            foreach ($event as &$evt) {
                $this->on($evt, $callback, $priority);
            }
            return $this;
        }

        if (!isset($this->events[$event])) $this->events[$event] = [];

        // make $this available in closures
        if (is_object($callback) && $callback instanceof \Closure) {
            $callback = $callback->bindTo($this, $this);
        }

        $this->events[$event][] = ['fn' => $callback, 'prio' => $priority];

        return $this;
    }
public function on ( $ event , $ callback , $ priority = 0 ) { if ( is_array ( $ event ) ) { foreach ( $ event as & $ evt ) { $ this -> on ( $ evt , $ callback , $ priority ) ; } return $ this ; } if ( ! isset ( $ this -> events [ $ event ] ) ) $ this -> events [ $ event ] = [ ] ; // make $this available in closures if ( is_object ( $ callback ) && $ callback instanceof \ Closure ) { $ callback = $ callback -> bindTo ( $ this , $ this ) ; } $ this -> events [ $ event ] [ ] = [ 'fn' => $ callback , 'prio' => $ priority ] ; return $ this ; }
Bind an event to closure
@param  String  $event
@param  \Closure $callback
@param  Integer $priority
@return void
Bind an event to closure