Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe Uri
+ Graphe d'héritage de Uri:

Fonctions membres publiques

 __construct (string $uri='')
 
 __clone ()
 
 __toString ()
 
 getScheme ()
 
 getAuthority ()
 
 getUserInfo ()
 
 getHost ()
 
 getPort ()
 
 getPath ()
 
 getQuery ()
 
 getFragment ()
 
 withScheme ($scheme)
 
 withUserInfo ($user, $password=null)
 
 withHost ($host)
 
 withPort ($port)
 
 withPath ($path)
 
 withQuery ($query)
 
 withFragment ($fragment)
 

Champs de données

const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;='
 
const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~\pL'
 

Attributs protégés

 $allowedSchemes
 

Fonctions membres privées

 parseUri (string $uri)
 
 isNonStandardPort (string $scheme, string $host, ?int $port)
 
 filterScheme (string $scheme)
 
 filterUserInfoPart (string $part)
 
 filterPath (string $path)
 
 filterInvalidUtf8 (string $string)
 
 filterQuery (string $query)
 
 splitQueryValue (string $value)
 
 filterFragment (string $fragment)
 
 filterQueryOrFragment (string $value)
 
 urlEncodeChar (array $matches)
 

Fonctions membres privées statiques

static createUriString (string $scheme, string $authority, string $path, string $query, string $fragment)
 

Attributs privés

 $scheme = ''
 
 $userInfo = ''
 
 $host = ''
 
 $port
 
 $path = ''
 
 $query = ''
 
 $fragment = ''
 
 $uriString
 

Description détaillée

Implementation of Psr.

Provides a value object representing a URI for HTTP requests.

Instances of this class are considered immutable; all methods that might change state are implemented such that they retain the internal state of the current instance and return a new instance that contains the changed state.

Documentation des constructeurs et destructeur

◆ __construct()

__construct ( string  $uri = '')

Documentation des fonctions membres

◆ __clone()

__clone ( )

Operations to perform on clone.

Since cloning usually is for purposes of mutation, we reset the $uriString property so it will be re-calculated.

Références null.

◆ __toString()

__toString ( )

{Return the string representation as a URI reference.Depending on which components of the URI are present, the resulting string is either a full URI or relative reference according to RFC 3986, Section 4.1. The method concatenates the various components of the URI, using the appropriate delimiters:

  • If a scheme is present, it MUST be suffixed by ":".
  • If an authority is present, it MUST be prefixed by "//".
  • The path can be concatenated without delimiters. But there are two cases where the path has to be adjusted to make the URI reference valid as PHP does not allow to throw an exception in __toString():
    • If the path is rootless and an authority is present, the path MUST be prefixed by "/".
    • If the path is starting with more than one "/" and no authority is present, the starting slashes MUST be reduced to one.
  • If a query is present, it MUST be prefixed by "?".
  • If a fragment is present, it MUST be prefixed by "#".
Voir également
http://tools.ietf.org/html/rfc3986#section-4.1
Renvoie
string
}

Implémente UriInterface.

Références Uri\$uriString, Uri\getAuthority(), Uri\getPath(), et null.

◆ createUriString()

static createUriString ( string  $scheme,
string  $authority,
string  $path,
string  $query,
string  $fragment 
)
staticprivate

Create a URI string from its various parts

Références Uri\$fragment, Uri\$path, Uri\$query, Uri\$scheme, et Laminas\Diactoros\$uri.

◆ filterFragment()

filterFragment ( string  $fragment)
private

Filter a fragment value to ensure it is properly encoded.

Références Uri\$fragment, et Uri\filterQueryOrFragment().

Référencé par Uri\parseUri(), et Uri\withFragment().

◆ filterInvalidUtf8()

filterInvalidUtf8 ( string  $string)
private

Encode invalid UTF-8 characters in given string. All other characters are unchanged.

Références $i, et Uri\urlEncodeChar().

Référencé par Uri\filterPath(), Uri\filterQueryOrFragment(), et Uri\filterUserInfoPart().

◆ filterPath()

filterPath ( string  $path)
private

Filters the path of a URI to ensure it is properly encoded.

Références Uri\$path, $this, et Uri\filterInvalidUtf8().

Référencé par Uri\parseUri(), et Uri\withPath().

◆ filterQuery()

filterQuery ( string  $query)
private

Filter a query string to ensure it is propertly encoded.

Ensures that the values in the query string are properly urlencoded.

Références $key, $parts, Uri\$query, $value, Uri\filterQueryOrFragment(), null, et Uri\splitQueryValue().

Référencé par Uri\parseUri(), et Uri\withQuery().

◆ filterQueryOrFragment()

filterQueryOrFragment ( string  $value)
private

Filter a query string key or value, or a fragment.

Références $this, $value, et Uri\filterInvalidUtf8().

Référencé par Uri\filterFragment(), et Uri\filterQuery().

◆ filterScheme()

filterScheme ( string  $scheme)
private

Filters the scheme to ensure it is a valid scheme.

Paramètres
string$schemeScheme name.
Renvoie
string Filtered scheme.

Références Uri\$scheme.

Référencé par Uri\parseUri(), et Uri\withScheme().

◆ filterUserInfoPart()

filterUserInfoPart ( string  $part)
private

Filters a part of user info in a URI to ensure it is properly encoded.

Paramètres
string$part
Renvoie
string

Références $this, et Uri\filterInvalidUtf8().

Référencé par Uri\parseUri(), et Uri\withUserInfo().

◆ getAuthority()

getAuthority ( )

{Retrieve the authority component of the URI.If no authority information is present, this method MUST return an empty string.The authority syntax of the URI is:

[user-info@]host[:port]
If the port component is not set or is the standard port for the current scheme, it SHOULD NOT be included.
Voir également
https://tools.ietf.org/html/rfc3986#section-3.2
Renvoie
string The URI authority, in "[user-info@]host[:port]" format.
}

Implémente UriInterface.

Références Uri\$host, Uri\$port, et Uri\isNonStandardPort().

Référencé par Uri\__toString().

◆ getFragment()

getFragment ( )

{Retrieve the fragment component of the URI.If no fragment is present, this method MUST return an empty string.The leading "#" character is not part of the fragment and MUST NOT be added.The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3.5.

Voir également
https://tools.ietf.org/html/rfc3986#section-2
https://tools.ietf.org/html/rfc3986#section-3.5
Renvoie
string The URI fragment.
}

Implémente UriInterface.

Références Uri\$fragment.

◆ getHost()

getHost ( )

{Retrieve the host component of the URI.If no host is present, this method MUST return an empty string.The value returned MUST be normalized to lowercase, per RFC 3986 Section 3.2.2.

Voir également
http://tools.ietf.org/html/rfc3986#section-3.2.2
Renvoie
string The URI host.
}

Implémente UriInterface.

Références Uri\$host.

◆ getPath()

getPath ( )

{Retrieve the path component of the URI.The path can either be empty or absolute (starting with a slash) or rootless (not starting with a slash). Implementations MUST support all three syntaxes.Normally, the empty path "" and absolute path "/" are considered equal as defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically do this normalization because in contexts with a trimmed base path, e.g. the front controller, this difference becomes significant. It's the task of the user to handle both "" and "/".The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3.3.As an example, if the value should include a slash ("/") not intended as delimiter between path segments, that value MUST be passed in encoded form (e.g., "%2F") to the instance.

Voir également
https://tools.ietf.org/html/rfc3986#section-2
https://tools.ietf.org/html/rfc3986#section-3.3
Renvoie
string The URI path.
}

Implémente UriInterface.

Références Uri\$path.

Référencé par Uri\__toString().

◆ getPort()

getPort ( )

{Retrieve the port component of the URI.If a port is present, and it is non-standard for the current scheme, this method MUST return it as an integer. If the port is the standard port used with the current scheme, this method SHOULD return null.If no port is present, and no scheme is present, this method MUST return a null value.If no port is present, but a scheme is present, this method MAY return the standard port for that scheme, but SHOULD return null.

Renvoie
null|int The URI port.
}

Implémente UriInterface.

Références Uri\isNonStandardPort(), et null.

◆ getQuery()

getQuery ( )

{Retrieve the query string of the URI.If no query string is present, this method MUST return an empty string.The leading "?" character is not part of the query and MUST NOT be added.The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3.4.As an example, if a value in a key/value pair of the query string should include an ampersand ("&") not intended as a delimiter between values, that value MUST be passed in encoded form (e.g., "%26") to the instance.

Voir également
https://tools.ietf.org/html/rfc3986#section-2
https://tools.ietf.org/html/rfc3986#section-3.4
Renvoie
string The URI query string.
}

Implémente UriInterface.

Références Uri\$query.

◆ getScheme()

getScheme ( )

{Retrieve the scheme component of the URI.If no scheme is present, this method MUST return an empty string.The value returned MUST be normalized to lowercase, per RFC 3986 Section 3.1.The trailing ":" character is not part of the scheme and MUST NOT be added.

Voir également
https://tools.ietf.org/html/rfc3986#section-3.1
Renvoie
string The URI scheme.
}

Implémente UriInterface.

Références Uri\$scheme.

◆ getUserInfo()

getUserInfo ( )

Retrieve the user-info part of the URI.

This value is percent-encoded, per RFC 3986 Section 3.2.1.

{Retrieve the user information component of the URI.If no user information is present, this method MUST return an empty string.If a user is present in the URI, this will return that value; additionally, if the password is also present, it will be appended to the user value, with a colon (":") separating the values.The trailing "@" character is not part of the user information and MUST NOT be added.

Renvoie
string The URI user information, in "username[:password]" format.
}

Implémente UriInterface.

Références Uri\$userInfo.

◆ isNonStandardPort()

isNonStandardPort ( string  $scheme,
string  $host,
?int  $port 
)
private

Is a given port non-standard for the current scheme?

Références Uri\$host, Uri\$port, Uri\$scheme, et null.

Référencé par Uri\getAuthority(), et Uri\getPort().

◆ parseUri()

parseUri ( string  $uri)
private

Parse a URI into its parts, and set the properties

Références $parts, Laminas\Diactoros\$uri, Uri\filterFragment(), Uri\filterPath(), Uri\filterQuery(), Uri\filterScheme(), Uri\filterUserInfoPart(), null, et path.

Référencé par Uri\__construct().

◆ splitQueryValue()

splitQueryValue ( string  $value)
private

Split a query value into a key/value tuple.

Paramètres
string$value
Renvoie
array A value with exactly two elements, key and value

Références $data, $value, et null.

Référencé par Uri\filterQuery().

◆ urlEncodeChar()

urlEncodeChar ( array  $matches)
private

URL encode a character returned by a regex.

Référencé par Uri\filterInvalidUtf8().

◆ withFragment()

withFragment (   $fragment)

{Return an instance with the specified URI fragment.This method MUST retain the state of the current instance, and return an instance that contains the specified URI fragment.Users can provide both encoded and decoded fragment characters. Implementations ensure the correct encoding as outlined in getFragment().An empty fragment value is equivalent to removing the fragment.

Paramètres
string$fragmentThe fragment to use with the new instance.
Renvoie
static A new instance with the specified fragment.
}

Implémente UriInterface.

Références Uri\$fragment, $this, et Uri\filterFragment().

◆ withHost()

withHost (   $host)

{Return an instance with the specified host.This method MUST retain the state of the current instance, and return an instance that contains the specified host.An empty host value is equivalent to removing the host.

Paramètres
string$hostThe hostname to use with the new instance.
Renvoie
static A new instance with the specified host.
Exceptions
}

Implémente UriInterface.

Références Uri\$host, et $this.

◆ withPath()

withPath (   $path)

{Return an instance with the specified path.This method MUST retain the state of the current instance, and return an instance that contains the specified path.The path can either be empty or absolute (starting with a slash) or rootless (not starting with a slash). Implementations MUST support all three syntaxes.If the path is intended to be domain-relative rather than path relative then it must begin with a slash ("/"). Paths not starting with a slash ("/") are assumed to be relative to some base path known to the application or consumer.Users can provide both encoded and decoded path characters. Implementations ensure the correct encoding as outlined in getPath().

Paramètres
string$pathThe path to use with the new instance.
Renvoie
static A new instance with the specified path.
Exceptions
}

Implémente UriInterface.

Références Uri\$path, $this, Uri\filterPath(), et path.

◆ withPort()

withPort (   $port)

{Return an instance with the specified port.This method MUST retain the state of the current instance, and return an instance that contains the specified port.Implementations MUST raise an exception for ports outside the established TCP and UDP port ranges.A null value provided for the port is equivalent to removing the port information.

Paramètres
null | int$portThe port to use with the new instance; a null value removes the port information.
Renvoie
static A new instance with the specified port.
Exceptions
}

Implémente UriInterface.

Références Uri\$port, $this, et null.

◆ withQuery()

withQuery (   $query)

{Return an instance with the specified query string.This method MUST retain the state of the current instance, and return an instance that contains the specified query string.Users can provide both encoded and decoded query characters. Implementations ensure the correct encoding as outlined in getQuery().An empty query string value is equivalent to removing the query string.

Paramètres
string$queryThe query string to use with the new instance.
Renvoie
static A new instance with the specified query string.
Exceptions
}

Implémente UriInterface.

Références Uri\$query, $this, et Uri\filterQuery().

◆ withScheme()

withScheme (   $scheme)

{Return an instance with the specified scheme.This method MUST retain the state of the current instance, and return an instance that contains the specified scheme.Implementations MUST support the schemes "http" and "https" case insensitively, and MAY accommodate other schemes if required.An empty scheme is equivalent to removing the scheme.

Paramètres
string$schemeThe scheme to use with the new instance.
Renvoie
static A new instance with the specified scheme.
Exceptions
}

Implémente UriInterface.

Références Uri\$scheme, $this, et Uri\filterScheme().

◆ withUserInfo()

withUserInfo (   $user,
  $password = null 
)

Create and return a new instance containing the provided user credentials.

The value will be percent-encoded in the new instance, but with measures taken to prevent double-encoding.

{Return an instance with the specified user information.This method MUST retain the state of the current instance, and return an instance that contains the specified user information.Password is optional, but the user information MUST include the user; an empty string for the user is equivalent to removing user information.

Paramètres
string$userThe user name to use for authority.
null | string$passwordThe password associated with $user.
Renvoie
static A new instance with the specified user information.
}

Implémente UriInterface.

Références $info, $password, $this, $user, Uri\filterUserInfoPart(), et null.

Documentation des champs

◆ $allowedSchemes

$allowedSchemes
protected
Valeur initiale :
= [
'http' => 80

◆ $fragment

$fragment = ''
private

◆ $host

$host = ''
private

◆ $path

◆ $port

$port
private

◆ $query

$query = ''
private

◆ $scheme

◆ $uriString

$uriString
private

Référencé par Uri\__toString().

◆ $userInfo

$userInfo = ''
private

Référencé par Uri\getUserInfo().

◆ CHAR_SUB_DELIMS

const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;='

Sub-delimiters used in user info, query strings and fragments.

string

◆ CHAR_UNRESERVED

const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~\pL'

Unreserved characters used in user info, paths, query strings, and fragments.

string


La documentation de cette classe a été générée à partir du fichier suivant :