YoastSEO_Vendor\GuzzleHttp\Psr7
Uri::composeComponents() public Yoast 1.0
Composes a URI reference string from its various components.
Usually this method does not need to be called manually but instead is used indirectly via Psr\Http\Message\UriInterface::__toString.
PSR-7 UriInterface treats an empty component the same as a missing component as getQuery(), getFragment() etc. always return a string. This explains the slight difference to RFC 3986 Section 5.3.
Another adjustment is that the authority separator is added even when the authority is missing/empty for the "file" scheme. This is because PHP stream functions like file_get_contents only work with file:///myfile but not with file:/myfile although they are equivalent according to RFC 3986. But file:/// is the more common syntax for the file scheme anyway (Chrome for example redirects to that format).
{} Это метод класса: Uri{}
Хуков нет.
Возвращает
Строку.
Использование
$result = Uri::composeComponents( $scheme, $authority, $path, $query, $fragment );
- $scheme(строка) (обязательный)
- $authority(строка) (обязательный)
- $path(строка) (обязательный)
- $query(строка) (обязательный)
- $fragment(строка) (обязательный)
Код Uri::composeComponents() Uri::composeComponents Yoast 15.6.2
public static function composeComponents($scheme, $authority, $path, $query, $fragment)
{
$uri = '';
// weak type checks to also accept null until we can add scalar type hints
if ($scheme != '') {
$uri .= $scheme . ':';
}
if ($authority != '' || $scheme === 'file') {
$uri .= '//' . $authority;
}
$uri .= $path;
if ($query != '') {
$uri .= '?' . $query;
}
if ($fragment != '') {
$uri .= '#' . $fragment;
}
return $uri;
}