Parsoid
A bidirectional parser between wikitext and HTML5
Parsoid\Utils\UrlUtils Class Reference

Utilities for manipulating URLs. More...

Static Public Member Functions

static parseUrl (string $url)
 Parse a possibly-relative URL into components. More...
 
static assembleUrl (array $urlParts)
 This function will reassemble a URL parsed with self::parseURL(). More...
 
static removeDotSegments (string $urlPath)
 Remove all dot-segments in the provided URL path. More...
 
static expandUrl (string $url, string $base)
 Expand a relative URL using a base URL. More...
 

Detailed Description

Utilities for manipulating URLs.

See also
https://tools.ietf.org/html/rfc3986

Member Function Documentation

◆ assembleUrl()

static Parsoid\Utils\UrlUtils::assembleUrl ( array  $urlParts)
static

This function will reassemble a URL parsed with self::parseURL().

Note no percent-encoding or syntax validation is performed.

Parameters
array$urlPartsURL parts, as output from self::parseUrl
Returns
string URL assembled from its component parts

◆ expandUrl()

static Parsoid\Utils\UrlUtils::expandUrl ( string  $url,
string  $base 
)
static

Expand a relative URL using a base URL.

See also
https://tools.ietf.org/html/rfc3986#section-5.2.2
Parameters
string$urlRelative URL to expand
string$baseBase URL to expand relative to
Returns
string Expanded URL

◆ parseUrl()

static Parsoid\Utils\UrlUtils::parseUrl ( string  $url)
static

Parse a possibly-relative URL into components.

Note no percent-decoding is performed, and only minimal syntax validation.

Parameters
string$url
Returns
(string|null)[]
  • 'scheme': Scheme of the url, if any.
  • 'authority': Authority part of the url, if any. This is the part in between the "//" and the path. For http, this is the "user@host:port".
  • 'path': Path part of the URL. Never null, but may be the empty string.
  • 'query': Query part of the URL, if any.
  • 'fragment': Fragment part of the URL, if any.

◆ removeDotSegments()

static Parsoid\Utils\UrlUtils::removeDotSegments ( string  $urlPath)
static

Remove all dot-segments in the provided URL path.

For example, '/a/./b/../c/' becomes '/a/c/'.

See also
https://tools.ietf.org/html/rfc3986#section-5.2.4
Note
Copied from MediaWiki's wfRemoveDotSegments
Parameters
string$urlPathURL path, potentially containing dot-segments
Returns
string URL path with all dot-segments removed

The documentation for this class was generated from the following file: