public function addListener($listener, $event, $prior = null)
    {
        if (!is_callable($event)) {
            return false;
        }

        if (!array_key_exists($listener, $this->listeners)) {
            $this->listeners[$listener] = [];
        }

        if (!$prior) {
            $this->listeners[$listener][] = $event;
        } else {
            array_splice($this->listeners[$listener], $prior, 0, $event);
        }

        return true;
    }
public function addListener($listener, $event, $prior = null)
    {
        if (!is_callable($event)) {
            return false;
        }

        if (!array_key_exists($listener, $this->listeners)) {
            $this->listeners[$listener] = [];
        }

        if (!$prior) {
            $this->listeners[$listener][] = $event;
        } else {
            array_splice($this->listeners[$listener], $prior, 0, $event);
        }

        return true;
    }
public function addListener ( $ listener , $ event , $ prior = null ) { if ( ! is_callable ( $ event ) ) { return false ; } if ( ! array_key_exists ( $ listener , $ this -> listeners ) ) { $ this -> listeners [ $ listener ] = [ ] ; } if ( ! $ prior ) { $ this -> listeners [ $ listener ] [ ] = $ event ; } else { array_splice ( $ this -> listeners [ $ listener ] , $ prior , 0 , $ event ) ; } return true ; }
Add listener on event

@access public

@param string $listener listener name
@param array $event ['Object', 'method'] or callable
@param int|null $prior priority

@return bool
Add listener on event