original_string: protected function forceSsl()
      {
          // Define and trim base URL
          $baseUrl = trim($this->settings->sslRoutingBaseUrl);
  
          // Parse dynamic params in SSL routing URL
          if (mb_stripos($baseUrl, '{') !== false)
          {
              $baseUrl = Craft::$app->view->renderObjectTemplate(
                  $this->settings->sslRoutingBaseUrl,
                  $this->getDynamicParams()
              );
          }
  
          // Protect against invalid base URL
          if (empty($baseUrl) || $baseUrl == '/')
          {
              $baseUrl = trim(Craft::$app->request->hostInfo);
          }
  
          // Define and trim URI to append to the base URL
          $requestUri = trim(Craft::$app->request->getUrl());
  
          // Base URL should now be set to 'http://domain.ext' or 'http://domain.ext/'
          // Request URI can could be empty or '/page?key=val'
  
          // Define the final URL formed by the host portion and the URI portion
          $url = sprintf('%s%s', rtrim($baseUrl, '/'), $requestUri);
  
          // Ensure https is used
          $url = str_replace('http:', 'https:', $url);
  
          if (!filter_var($url, FILTER_VALIDATE_URL))
          {
              throw new ErrorException(
                  Craft::t('patrol', '{url} is not a valid URL', ['url' => $url])
              );
          }
  
          Craft::$app->response->redirect(
              $url,
              $this->settings->redirectStatusCode
          );
      }
code: protected function forceSsl()
      {
          // Define and trim base URL
          $baseUrl = trim($this->settings->sslRoutingBaseUrl);
  
          // Parse dynamic params in SSL routing URL
          if (mb_stripos($baseUrl, '{') !== false)
          {
              $baseUrl = Craft::$app->view->renderObjectTemplate(
                  $this->settings->sslRoutingBaseUrl,
                  $this->getDynamicParams()
              );
          }
  
          // Protect against invalid base URL
          if (empty($baseUrl) || $baseUrl == '/')
          {
              $baseUrl = trim(Craft::$app->request->hostInfo);
          }
  
          // Define and trim URI to append to the base URL
          $requestUri = trim(Craft::$app->request->getUrl());
  
          // Base URL should now be set to 'http://domain.ext' or 'http://domain.ext/'
          // Request URI can could be empty or '/page?key=val'
  
          // Define the final URL formed by the host portion and the URI portion
          $url = sprintf('%s%s', rtrim($baseUrl, '/'), $requestUri);
  
          // Ensure https is used
          $url = str_replace('http:', 'https:', $url);
  
          if (!filter_var($url, FILTER_VALIDATE_URL))
          {
              throw new ErrorException(
                  Craft::t('patrol', '{url} is not a valid URL', ['url' => $url])
              );
          }
  
          Craft::$app->response->redirect(
              $url,
              $this->settings->redirectStatusCode
          );
      }
code_tokens: protected function forceSsl ( ) { // Define and trim base URL $ baseUrl = trim ( $ this -> settings -> sslRoutingBaseUrl ) ; // Parse dynamic params in SSL routing URL if ( mb_stripos ( $ baseUrl , '{' ) !== false ) { $ baseUrl = Craft :: $ app -> view -> renderObjectTemplate ( $ this -> settings -> sslRoutingBaseUrl , $ this -> getDynamicParams ( ) ) ; } // Protect against invalid base URL if ( empty ( $ baseUrl ) || $ baseUrl == '/' ) { $ baseUrl = trim ( Craft :: $ app -> request -> hostInfo ) ; } // Define and trim URI to append to the base URL $ requestUri = trim ( Craft :: $ app -> request -> getUrl ( ) ) ; // Base URL should now be set to 'http://domain.ext' or 'http://domain.ext/' // Request URI can could be empty or '/page?key=val' // Define the final URL formed by the host portion and the URI portion $ url = sprintf ( '%s%s' , rtrim ( $ baseUrl , '/' ) , $ requestUri ) ; // Ensure https is used $ url = str_replace ( 'http:' , 'https:' , $ url ) ; if ( ! filter_var ( $ url , FILTER_VALIDATE_URL ) ) { throw new ErrorException ( Craft :: t ( 'patrol' , '{url} is not a valid URL' , [ 'url' => $ url ] ) ) ; } Craft :: $ app -> response -> redirect ( $ url , $ this -> settings -> redirectStatusCode ) ; }
docstring: Redirects to the HTTPS version of the requested URL
  
  @throws ErrorException
  @throws \yii\base\Exception
  @throws \yii\base\InvalidConfigException
docstring_tokens: Redirects to the HTTPS version of the requested URL