original_string: private static function encodeUrl($url)
      {
          $url_parsed = parse_url($url);
          $scheme = $url_parsed['scheme'] . '://';
          $host   = $url_parsed['host'];
          $port   = (isset($url_parsed['port']) ? $url_parsed['port'] : null);
          $path   = (isset($url_parsed['path']) ? $url_parsed['path'] : null);
          $query  = (isset($url_parsed['query']) ? $url_parsed['query'] : null);
          if ($query != null) {
              $query = '?' . http_build_query(self::getArrayFromQuerystring($url_parsed['query']));
          }
          if ($port && $port[0] != ":") {
              $port = ":" . $port;
          }
          $result = $scheme . $host . $port . $path . $query;
          return $result;
      }
code: private static function encodeUrl($url)
      {
          $url_parsed = parse_url($url);
          $scheme = $url_parsed['scheme'] . '://';
          $host   = $url_parsed['host'];
          $port   = (isset($url_parsed['port']) ? $url_parsed['port'] : null);
          $path   = (isset($url_parsed['path']) ? $url_parsed['path'] : null);
          $query  = (isset($url_parsed['query']) ? $url_parsed['query'] : null);
          if ($query != null) {
              $query = '?' . http_build_query(self::getArrayFromQuerystring($url_parsed['query']));
          }
          if ($port && $port[0] != ":") {
              $port = ":" . $port;
          }
          $result = $scheme . $host . $port . $path . $query;
          return $result;
      }
code_tokens: private static function encodeUrl ( $ url ) { $ url_parsed = parse_url ( $ url ) ; $ scheme = $ url_parsed [ 'scheme' ] . '://' ; $ host = $ url_parsed [ 'host' ] ; $ port = ( isset ( $ url_parsed [ 'port' ] ) ? $ url_parsed [ 'port' ] : null ) ; $ path = ( isset ( $ url_parsed [ 'path' ] ) ? $ url_parsed [ 'path' ] : null ) ; $ query = ( isset ( $ url_parsed [ 'query' ] ) ? $ url_parsed [ 'query' ] : null ) ; if ( $ query != null ) { $ query = '?' . http_build_query ( self :: getArrayFromQuerystring ( $ url_parsed [ 'query' ] ) ) ; } if ( $ port && $ port [ 0 ] != ":" ) { $ port = ":" . $ port ; } $ result = $ scheme . $ host . $ port . $ path . $ query ; return $ result ; }
docstring: Ensure that a URL is encoded and safe to use with cURL
  @param  string $url URL to encode
  @return string
docstring_tokens: Ensure that a URL is encoded and safe to use with cURL