public function acceptInvitation()
    {
        if ($this->isInvitationTokenAccepted()) {
            throw new UserInvitationAlreadyAcceptedException();
        }
        if ($this->isInvitationTokenExpired()) {
            throw new UserTokenExpiredException();
        }
        $this->invitationToken = null;
        $this->updatedOn = new \DateTimeImmutable();
        $this->publish(
            new UserRegistered(
                $this->id(),
                $this->email()
            )
        );
    }
public function acceptInvitation()
    {
        if ($this->isInvitationTokenAccepted()) {
            throw new UserInvitationAlreadyAcceptedException();
        }
        if ($this->isInvitationTokenExpired()) {
            throw new UserTokenExpiredException();
        }
        $this->invitationToken = null;
        $this->updatedOn = new \DateTimeImmutable();
        $this->publish(
            new UserRegistered(
                $this->id(),
                $this->email()
            )
        );
    }
public function acceptInvitation ( ) { if ( $ this -> isInvitationTokenAccepted ( ) ) { throw new UserInvitationAlreadyAcceptedException ( ) ; } if ( $ this -> isInvitationTokenExpired ( ) ) { throw new UserTokenExpiredException ( ) ; } $ this -> invitationToken = null ; $ this -> updatedOn = new \ DateTimeImmutable ( ) ; $ this -> publish ( new UserRegistered ( $ this -> id ( ) , $ this -> email ( ) ) ) ; }
Accepts the invitation request.

@throws UserTokenExpiredException when the token is expired
Accepts the invitation request .