public static function Uri::withoutQueryValue in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/psr7/src/Uri.php \GuzzleHttp\Psr7\Uri::withoutQueryValue()
Create a new URI with a specific query string value removed.
Any existing query string values that exactly match the provided key are removed.
Note: this function will convert "=" to "%3D" and "&" to "%26".
Parameters
UriInterface $uri URI to use as a base.:
string $key Query string key value pair to remove.:
Return value
1 call to Uri::withoutQueryValue()
- UriTest::testAddAndRemoveQueryValues in vendor/
guzzlehttp/ psr7/ tests/ UriTest.php
File
- vendor/
guzzlehttp/ psr7/ src/ Uri.php, line 199
Class
- Uri
- Basic PSR-7 URI implementation.
Namespace
GuzzleHttp\Psr7Code
public static function withoutQueryValue(UriInterface $uri, $key) {
$current = $uri
->getQuery();
if (!$current) {
return $uri;
}
$result = [];
foreach (explode('&', $current) as $part) {
if (explode('=', $part)[0] !== $key) {
$result[] = $part;
}
}
return $uri
->withQuery(implode('&', $result));
}