original_string: public function detectUrlDetails()
      {
          $escapedPathPrefix = Text::escapeForRegex($this->config->getPathPrefix());
          $languages = implode('|', $this->translate->getLanguages());
  
          $fullUrl = preg_replace('#' . $escapedPathPrefix . '\/(' . $languages . ')$#i', '', $this->getUrl());
          $fullUrl = preg_replace('#' . $escapedPathPrefix . '\/(' . $languages . ')\/#i', '/', $fullUrl);
  
          $parsed = parse_url($fullUrl);
  
          $this->host = $parsed['scheme'] . '://' . $parsed['host'] . (isset($parsed['port']) ? ':'.$parsed['port'] : '');
          $this->path = isset($parsed['path']) ? $parsed['path'] : '/';
          $this->query = isset($parsed['query']) ? $parsed['query'] : null;
  
          if (preg_match('#^' .$this->config->getPathPrefix(). '#i', $this->path)) {
              $this->path = preg_replace('#^' .$this->config->getPathPrefix(). '#i', '', $this->path);
          }
  
          if ($this->path === "") {
              $this->path = '/';
          }
  
          $url = $this->getHost() . $this->getPathPrefix() . $this->getPath();
          if (!is_null($this->getQuery())) {
              $url .= '?'. $this->getQuery();
          }
          return $url;
      }
code: public function detectUrlDetails()
      {
          $escapedPathPrefix = Text::escapeForRegex($this->config->getPathPrefix());
          $languages = implode('|', $this->translate->getLanguages());
  
          $fullUrl = preg_replace('#' . $escapedPathPrefix . '\/(' . $languages . ')$#i', '', $this->getUrl());
          $fullUrl = preg_replace('#' . $escapedPathPrefix . '\/(' . $languages . ')\/#i', '/', $fullUrl);
  
          $parsed = parse_url($fullUrl);
  
          $this->host = $parsed['scheme'] . '://' . $parsed['host'] . (isset($parsed['port']) ? ':'.$parsed['port'] : '');
          $this->path = isset($parsed['path']) ? $parsed['path'] : '/';
          $this->query = isset($parsed['query']) ? $parsed['query'] : null;
  
          if (preg_match('#^' .$this->config->getPathPrefix(). '#i', $this->path)) {
              $this->path = preg_replace('#^' .$this->config->getPathPrefix(). '#i', '', $this->path);
          }
  
          if ($this->path === "") {
              $this->path = '/';
          }
  
          $url = $this->getHost() . $this->getPathPrefix() . $this->getPath();
          if (!is_null($this->getQuery())) {
              $url .= '?'. $this->getQuery();
          }
          return $url;
      }
code_tokens: public function detectUrlDetails ( ) { $ escapedPathPrefix = Text :: escapeForRegex ( $ this -> config -> getPathPrefix ( ) ) ; $ languages = implode ( '|' , $ this -> translate -> getLanguages ( ) ) ; $ fullUrl = preg_replace ( '#' . $ escapedPathPrefix . '\/(' . $ languages . ')$#i' , '' , $ this -> getUrl ( ) ) ; $ fullUrl = preg_replace ( '#' . $ escapedPathPrefix . '\/(' . $ languages . ')\/#i' , '/' , $ fullUrl ) ; $ parsed = parse_url ( $ fullUrl ) ; $ this -> host = $ parsed [ 'scheme' ] . '://' . $ parsed [ 'host' ] . ( isset ( $ parsed [ 'port' ] ) ? ':' . $ parsed [ 'port' ] : '' ) ; $ this -> path = isset ( $ parsed [ 'path' ] ) ? $ parsed [ 'path' ] : '/' ; $ this -> query = isset ( $ parsed [ 'query' ] ) ? $ parsed [ 'query' ] : null ; if ( preg_match ( '#^' . $ this -> config -> getPathPrefix ( ) . '#i' , $ this -> path ) ) { $ this -> path = preg_replace ( '#^' . $ this -> config -> getPathPrefix ( ) . '#i' , '' , $ this -> path ) ; } if ( $ this -> path === "" ) { $ this -> path = '/' ; } $ url = $ this -> getHost ( ) . $ this -> getPathPrefix ( ) . $ this -> getPath ( ) ; if ( ! is_null ( $ this -> getQuery ( ) ) ) { $ url .= '?' . $ this -> getQuery ( ) ; } return $ url ; }
docstring: Generate possible host & base URL then store it into internal variables
  
  @return string   Host + path prefix + base URL
docstring_tokens: Generate possible host & base URL then store it into internal variables