Ejemplo n.º 1
0
 /**
  * Returns true if everything is OK. If it isn't, an exception is thrown.
  *
  * @return boolean true if everything is OK. Otherwise, an exception is thrown.
  *
  * @throws Exception `INVALID_MAIL`
  * @throws Exception `INVALID_PRODUCT_REG_NUM`
  * @throws Exception `NON_ACCEPTED_TAC`
  * @throws Exception `BACKEND_NO_SITE_CONFIGURED`
  * @throws Exception `DEACTIVATED_USER`
  *
  * @since 2.1.0
  */
 public static function check_user_settings()
 {
     if (!NelioABAccountSettings::is_email_valid()) {
         $err = NelioABErrCodes::INVALID_MAIL;
         throw new Exception(NelioABErrCodes::to_string($err), $err);
     }
     if (!NelioABAccountSettings::is_reg_num_valid()) {
         $err = NelioABErrCodes::INVALID_PRODUCT_REG_NUM;
         throw new Exception(NelioABErrCodes::to_string($err), $err);
     }
     if (!NelioABAccountSettings::are_terms_and_conditions_accepted()) {
         $err = NelioABErrCodes::NON_ACCEPTED_TAC;
         throw new Exception(NelioABErrCodes::to_string($err), $err);
     }
     if (!NelioABAccountSettings::has_a_configured_site()) {
         $err = NelioABErrCodes::BACKEND_NO_SITE_CONFIGURED;
         throw new Exception(NelioABErrCodes::to_string($err), $err);
     }
     NelioABAccountSettings::check_account_status();
     if (!NelioABAccountSettings::is_account_active()) {
         $err = NelioABErrCodes::DEACTIVATED_USER;
         throw new Exception(NelioABErrCodes::to_string($err), $err);
     }
     return true;
 }