public function removeSubject(\SplSubject $subject): self
    {
        $key = array_search($subject, $this->subjectList, true);
        
        if ($key === false) {
            throw new Exception(
                'The subject has not been found.',
                self::ERR_SUBJECT_NOT_FOUND
            );
        }
        
        unset($this->subjectList[$key]);

        return $this;
    }
public function removeSubject(\SplSubject $subject): self
    {
        $key = array_search($subject, $this->subjectList, true);
        
        if ($key === false) {
            throw new Exception(
                'The subject has not been found.',
                self::ERR_SUBJECT_NOT_FOUND
            );
        }
        
        unset($this->subjectList[$key]);

        return $this;
    }
public function removeSubject ( \ SplSubject $ subject ) : self { $ key = array_search ( $ subject , $ this -> subjectList , true ) ; if ( $ key === false ) { throw new Exception ( 'The subject has not been found.' , self :: ERR_SUBJECT_NOT_FOUND ) ; } unset ( $ this -> subjectList [ $ key ] ) ; return $ this ; }
Remove a subject from the list

@param \SplSubject $subject The subject to remove from the list

@return $this

@throws \Exception If the subject has not been found into the list
Remove a subject from the list