public function attach(SplObserver $observer)
    {
        foreach ($this->observers as $attached) {
            if ($attached === $observer) {
                return;
            }
        }
        $this->observers[] = $observer;
    }
public function attach(SplObserver $observer)
    {
        foreach ($this->observers as $attached) {
            if ($attached === $observer) {
                return;
            }
        }
        $this->observers[] = $observer;
    }
public function attach ( SplObserver $ observer ) { foreach ( $ this -> observers as $ attached ) { if ( $ attached === $ observer ) { return ; } } $ this -> observers [ ] = $ observer ; }
Attaches a new observer

@param SplObserver $observer any object implementing SplObserver
Attaches a new observer