public function attach($name, \Closure $callback, $priority = 0)
    {
        $key = $this->storeCallback($callback);

        if (is_array($name)) {
            foreach ($name as $event) {
                $this->pushToQueue($event, $key, $priority);
            }
        } else {
            $this->pushToQueue($name, $key, $priority);
        }

        return $this;
    }
public function attach($name, \Closure $callback, $priority = 0)
    {
        $key = $this->storeCallback($callback);

        if (is_array($name)) {
            foreach ($name as $event) {
                $this->pushToQueue($event, $key, $priority);
            }
        } else {
            $this->pushToQueue($name, $key, $priority);
        }

        return $this;
    }
public function attach ( $ name , \ Closure $ callback , $ priority = 0 ) { $ key = $ this -> storeCallback ( $ callback ) ; if ( is_array ( $ name ) ) { foreach ( $ name as $ event ) { $ this -> pushToQueue ( $ event , $ key , $ priority ) ; } } else { $ this -> pushToQueue ( $ name , $ key , $ priority ) ; } return $ this ; }
Register a listener attached to a particular named event.

All listeners have there callbacks firstly stored within an associative array
using a unique md5 hash as an index and the callback as it's value.

All event names are then stored within an associative array of splpriorityqueues. The
index of these arrays is the name of the event while the value inserted into the queue
is the above metnioned unique md5 hash.

This allows a listener to attach itself to be triggered against multiple events
without having multiple copies of the callback being stored.

Default priority is 0, the higher the number of the priority the earlier the
listener will respond, negative priorities are allowed.

The name option can optionally take the form of an array of events for the listener
to attach itself with. A wildcard '*' is also provided and will attach the
listener to be triggered against all events.

Be aware that attaching a listener to the same event multiple times will trigger
that listener multiple times. This includes using the wildcard.

@param string|array The name(s) of the event(s) to listen for.
@param closure $callback The callback to execute when the event is triggered.
@param int $priority The priority at which to execute this listener.
Register a listener attached to a particular named event .