Documentation

BaseUri
in package
implements Stringable, JsonSerializable, UriAccess

since version 7.6.0

Tags
phpstan-import-type

ComponentMap from UriInterface

see
Modifier
see
Uri

Table of Contents

Interfaces

Stringable
JsonSerializable
UriAccess

Constants

DOT_SEGMENTS  = ['.' => 1, '..' => 1]
WHATWG_SPECIAL_SCHEMES  = ['ftp' => 1, 'http' => 1, 'https' => 1, 'ws' => 1, 'wss' => 1]

Properties

$nullValue  : string|null
$origin  : UriInterface|UriInterface|null
$uri  : UriInterface|UriInterface
$uriFactory  : UriFactoryInterface|null

Methods

__toString()  : string
from()  : static
getUri()  : UriInterface|UriInterface
getUriString()  : string
Returns the RFC3986 string representation of the complete URI.
hasIdn()  : bool
Tells whether the URI contains an Internationalized Domain Name (IDN).
hasIPv4()  : bool
Tells whether the URI contains an IPv4 regardless if it is mapped or native.
isAbsolute()  : bool
Tells whether the URI is absolute.
isAbsolutePath()  : bool
Tells whether the URI is an absolute path.
isCrossOrigin()  : bool
Tells whether two URI do not share the same origin.
isLocalFile()  : bool
Tells whether the `file` scheme base URI represents a local file.
isNetworkPath()  : bool
Tells whether the URI is a network path.
isOpaque()  : bool
Tells whether the URI is opaque or not.
isRelativePath()  : bool
Tells whether the URI is a relative path.
isSameDocument()  : bool
Tells whether both URI refers to the same document.
jsonSerialize()  : string
origin()  : self|null
relativize()  : static
Relativize a URI according to a base URI.
resolve()  : static
Resolves a URI against a base URI using RFC3986 rules.
toRfc8089()  : string|null
Returns a string representation of a File URI according to RFC8089.
unixPath()  : string|null
Returns the Unix filesystem path.
windowsPath()  : string|null
Returns the Windows filesystem path.
withoutUriFactory()  : static
withUriFactory()  : static
__construct()  : mixed
canNotBeRelativize()  : bool
Tells whether the submitted URI object can be relativized.
componentEquals()  : bool
Tells whether the component value from both URI object equals.
computeOrigin()  : UriInterface|UriInterface|null
filterUri()  : UriInterface|UriInterface
Input URI normalization to allow Stringable and string URI.
formatHost()  : UriInterface|UriInterface
Filter the URI object.
formatPath()  : string
Formatting the path to keep a valid URI.
formatPathWithEmptyBaseQuery()  : string
Formatting the path to keep a resolvable URI.
getSegments()  : array<string|int, string>
returns the path segments.
normalize()  : string
Normalizes a URI for comparison; this URI string representation is not suitable for usage as per RFC guidelines.
relativizePath()  : string
Relatives the URI for an authority-less target URI.
removeDotSegments()  : string
Remove dot segments from the URI path as per RFC specification.
resolvePathAndQuery()  : array{0: string, 1: string|null}
Resolves an URI path and query component.
normalizedUri()  : Uri

Constants

DOT_SEGMENTS

protected final array<string, int> DOT_SEGMENTS = ['.' => 1, '..' => 1]

WHATWG_SPECIAL_SCHEMES

protected final array<string, int> WHATWG_SPECIAL_SCHEMES = ['ftp' => 1, 'http' => 1, 'https' => 1, 'ws' => 1, 'wss' => 1]

Properties

$nullValue read-only

protected string|null $nullValue

Methods

__toString()

public __toString() : string
Return values
string

getUriString()

Returns the RFC3986 string representation of the complete URI.

public getUriString() : string
Return values
string

hasIdn()

Tells whether the URI contains an Internationalized Domain Name (IDN).

public hasIdn() : bool
Return values
bool

hasIPv4()

Tells whether the URI contains an IPv4 regardless if it is mapped or native.

public hasIPv4() : bool
Return values
bool

isAbsolute()

Tells whether the URI is absolute.

public isAbsolute() : bool
Return values
bool

isAbsolutePath()

Tells whether the URI is an absolute path.

public isAbsolutePath() : bool
Return values
bool

isCrossOrigin()

Tells whether two URI do not share the same origin.

public isCrossOrigin(Stringable|string $uri) : bool
Parameters
$uri : Stringable|string
Return values
bool

isLocalFile()

Tells whether the `file` scheme base URI represents a local file.

public isLocalFile() : bool
Return values
bool

isNetworkPath()

Tells whether the URI is a network path.

public isNetworkPath() : bool
Return values
bool

isOpaque()

Tells whether the URI is opaque or not.

public isOpaque() : bool

A URI is opaque if and only if it is absolute and does not have an authority path.

Return values
bool

isRelativePath()

Tells whether the URI is a relative path.

public isRelativePath() : bool
Return values
bool

isSameDocument()

Tells whether both URI refers to the same document.

public isSameDocument(Stringable|string $uri) : bool
Parameters
$uri : Stringable|string
Return values
bool

jsonSerialize()

public jsonSerialize() : string
Return values
string

origin()

public origin() : self|null
Return values
self|null

relativize()

Relativize a URI according to a base URI.

public relativize(Stringable|string $uri) : static

This method MUST retain the state of the submitted URI instance, and return a URI instance of the same type that contains the applied modifications.

This method MUST be transparent when dealing with error and exceptions. It MUST not alter of silence them apart from validating its own parameters.

Parameters
$uri : Stringable|string
Return values
static

resolve()

Resolves a URI against a base URI using RFC3986 rules.

public resolve(Stringable|string $uri) : static

This method MUST retain the state of the submitted URI instance, and return a URI instance of the same type that contains the applied modifications.

This method MUST be transparent when dealing with error and exceptions. It MUST not alter or silence them apart from validating its own parameters.

Parameters
$uri : Stringable|string
Return values
static

toRfc8089()

Returns a string representation of a File URI according to RFC8089.

public toRfc8089() : string|null

The method will return null if the URI scheme is not the file scheme

Return values
string|null

unixPath()

Returns the Unix filesystem path.

public unixPath() : string|null

The method will return null if a scheme is present and is not the file scheme

Return values
string|null

windowsPath()

Returns the Windows filesystem path.

public windowsPath() : string|null

The method will return null if a scheme is present and is not the file scheme

Return values
string|null

withoutUriFactory()

public withoutUriFactory() : static
Return values
static

componentEquals()

Tells whether the component value from both URI object equals.

protected final componentEquals(string $property, UriInterface|UriInterface $uri) : bool
Parameters
$property : string
$uri : UriInterface|UriInterface
Tags
pqram

'query'|'authority'|'scheme' $property

Return values
bool

formatPath()

Formatting the path to keep a valid URI.

protected final static formatPath(string $path, string $basePath) : string
Parameters
$path : string
$basePath : string
Return values
string

formatPathWithEmptyBaseQuery()

Formatting the path to keep a resolvable URI.

protected final static formatPathWithEmptyBaseQuery(string $path) : string
Parameters
$path : string
Return values
string

getSegments()

returns the path segments.

protected final static getSegments(string $path) : array<string|int, string>
Parameters
$path : string
Return values
array<string|int, string>

normalize()

Normalizes a URI for comparison; this URI string representation is not suitable for usage as per RFC guidelines.

protected final normalize(UriInterface|UriInterface $uri) : string

since version 7.6.0

no longer used by the isSameDocument method

Parameters
$uri : UriInterface|UriInterface
Tags
codeCoverageIgnore
Return values
string

relativizePath()

Relatives the URI for an authority-less target URI.

protected final static relativizePath(string $path, string $basePath) : string
Parameters
$path : string
$basePath : string
Return values
string

removeDotSegments()

Remove dot segments from the URI path as per RFC specification.

protected final removeDotSegments(string $path) : string

since version 7.6.0

no longer used by the isSameDocument method

Parameters
$path : string
Tags
codeCoverageIgnore
Return values
string

resolvePathAndQuery()

Resolves an URI path and query component.

protected final resolvePathAndQuery(UriInterface|UriInterface $uri) : array{0: string, 1: string|null}

since version 7.6.0

no longer used by the isSameDocument method

Parameters
$uri : UriInterface|UriInterface
Tags
codeCoverageIgnore
Return values
array{0: string, 1: string|null}

        
On this page

Search results