public function attach($event, $callback, $priority = 0)
    {
        if (!isset($this->eventListeners[$event])) {
            $this->clearListeners($event);
        }

        $this->eventListeners[$event]->insert($callback, $priority);

        return true;
    }
public function attach($event, $callback, $priority = 0)
    {
        if (!isset($this->eventListeners[$event])) {
            $this->clearListeners($event);
        }

        $this->eventListeners[$event]->insert($callback, $priority);

        return true;
    }
public function attach ( $ event , $ callback , $ priority = 0 ) { if ( ! isset ( $ this -> eventListeners [ $ event ] ) ) { $ this -> clearListeners ( $ event ) ; } $ this -> eventListeners [ $ event ] -> insert ( $ callback , $ priority ) ; return true ; }
Attaches a listener to an event.

@param string   $event    the event to attach too
@param callable $callback a callable function
@param int      $priority the priority at which the $callback executed

@return bool true on success false on failure
Attaches a listener to an event .