public function attach($events, IObserver $observer)
    {
        if (is_array($events)) {
            foreach ($events as $event) {
                $this->doAttach($event, $observer);
            }
        } elseif (is_string($events)) {
            $this->doAttach($events, $observer);
        } else {
            throw new ObservableException("Event can only be a string containing the name of the event or an array of event names.");
        }
    }
public function attach($events, IObserver $observer)
    {
        if (is_array($events)) {
            foreach ($events as $event) {
                $this->doAttach($event, $observer);
            }
        } elseif (is_string($events)) {
            $this->doAttach($events, $observer);
        } else {
            throw new ObservableException("Event can only be a string containing the name of the event or an array of event names.");
        }
    }
public function attach ( $ events , IObserver $ observer ) { if ( is_array ( $ events ) ) { foreach ( $ events as $ event ) { $ this -> doAttach ( $ event , $ observer ) ; } } elseif ( is_string ( $ events ) ) { $ this -> doAttach ( $ events , $ observer ) ; } else { throw new ObservableException ( "Event can only be a string containing the name of the event or an array of event names." ) ; } }
Attach a listener.
@param  string|array        $events   The event type. This can be an array of event types or just a string for one event.
@param  IObserver           $observer The listener.
@throws ObservableException
Attach a listener .