1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850
|
<?php
/**
* League.Uri (https://uri.thephpleague.com)
*
* (c) Ignace Nyamagana Butera <nyamsprod@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace League\Uri;
use Deprecated;
use JsonSerializable;
use League\Uri\Components\DataPath;
use League\Uri\Components\Domain;
use League\Uri\Components\HierarchicalPath;
use League\Uri\Components\Host;
use League\Uri\Components\Path;
use League\Uri\Components\Query;
use League\Uri\Contracts\PathInterface;
use League\Uri\Contracts\UriAccess;
use League\Uri\Contracts\UriInterface;
use League\Uri\Exceptions\SyntaxError;
use League\Uri\Idna\Converter as IdnConverter;
use League\Uri\IPv4\Converter as IPv4Converter;
use League\Uri\IPv6\Converter;
use League\Uri\KeyValuePair\Converter as KeyValuePairConverter;
use Psr\Http\Message\UriFactoryInterface;
use Psr\Http\Message\UriInterface as Psr7UriInterface;
use Stringable;
use function get_object_vars;
use function ltrim;
use function rtrim;
use function str_ends_with;
use function str_starts_with;
class Modifier implements Stringable, JsonSerializable, UriAccess
{
final public function __construct(protected readonly Psr7UriInterface|UriInterface $uri)
{
}
/**
* @param UriFactoryInterface|null $uriFactory Deprecated, will be removed in the next major release
*/
public static function from(Stringable|string $uri, ?UriFactoryInterface $uriFactory = null): static
{
return new static(match (true) {
$uri instanceof UriAccess => $uri->getUri(),
$uri instanceof Psr7UriInterface, $uri instanceof UriInterface => $uri,
$uriFactory instanceof UriFactoryInterface => $uriFactory->createUri((string) $uri),
default => Uri::new($uri),
});
}
public function getUri(): Psr7UriInterface|UriInterface
{
return $this->uri;
}
public function getIdnUriString(): string
{
$currentHost = $this->uri->getHost();
if (null === $currentHost || '' === $currentHost) {
return $this->getUriString();
}
$host = IdnConverter::toUnicode($currentHost)->domain();
if ($host === $currentHost) {
return $this->getUriString();
}
$components = $this->uri instanceof UriInterface ? $this->uri->toComponents() : UriString::parse($this->uri);
$components['host'] = $host;
return UriString::build($components);
}
public function getUriString(): string
{
return $this->uri->__toString();
}
public function jsonSerialize(): string
{
return $this->uri->__toString();
}
public function __toString(): string
{
return $this->uri->__toString();
}
/*********************************
* Query modifier methods
*********************************/
/**
* Change the encoding of the query.
*/
public function encodeQuery(KeyValuePairConverter|int $to, KeyValuePairConverter|int|null $from = null): static
{
$to = match (true) {
!$to instanceof KeyValuePairConverter => KeyValuePairConverter::fromEncodingType($to),
default => $to,
};
$from = match (true) {
null === $from => KeyValuePairConverter::fromRFC3986(),
!$from instanceof KeyValuePairConverter => KeyValuePairConverter::fromEncodingType($from),
default => $from,
};
if ($to == $from) {
return $this;
}
$originalQuery = $this->uri->getQuery();
$query = QueryString::buildFromPairs(QueryString::parseFromValue($originalQuery, $from), $to);
return match (true) {
null === $query,
'' === $query,
$originalQuery === $query => $this,
default => new static($this->uri->withQuery($query)),
};
}
/**
* Sort the URI query by keys.
*/
public function sortQuery(): static
{
return new static($this->uri->withQuery(
static::normalizeComponent(
Query::fromUri($this->uri)->sort()->value(),
$this->uri
)
));
}
/**
* Add the new query data to the existing URI query.
*/
public function appendQuery(Stringable|string|null $query): static
{
return new static($this->uri->withQuery(
static::normalizeComponent(
Query::fromUri($this->uri)->append($query)->value(),
$this->uri
)
));
}
/**
* Merge query paris with the existing URI query.
*
* @param iterable<int, array{0:string, 1:string|null}> $pairs
*/
public function appendQueryPairs(iterable $pairs): self
{
return $this->appendQuery(Query::fromPairs($pairs)->value());
}
/**
* Append PHP query parameters to the existing URI query.
*/
public function appendQueryParameters(object|array $parameters): self
{
return $this->appendQuery(Query::fromVariable($parameters)->value());
}
/**
* Merge a new query with the existing URI query.
*/
public function mergeQuery(Stringable|string|null $query): static
{
return new static($this->uri->withQuery(
static::normalizeComponent(
Query::fromUri($this->uri)->merge($query)->value(),
$this->uri
)
));
}
/**
* Merge query paris with the existing URI query.
*
* @param iterable<int, array{0:string, 1:string|null}> $pairs
*/
public function mergeQueryPairs(iterable $pairs): self
{
$currentPairs = [...Query::fromUri($this->uri)->pairs()];
$pairs = [...$pairs];
return match (true) {
[] === $pairs,
$currentPairs === $pairs => $this,
default => $this->mergeQuery(Query::fromPairs($pairs)->value()),
};
}
/**
* Merge PHP query parameters with the existing URI query.
*/
public function mergeQueryParameters(object|array $parameters): self
{
$parameters = match (true) {
is_object($parameters) => get_object_vars($parameters),
default => $parameters,
};
$currentParameters = Query::fromUri($this->uri)->parameters();
return match (true) {
[] === $parameters,
$currentParameters === $parameters => $this,
default => new static($this->uri->withQuery(
self::normalizeComponent(
Query::fromVariable([...$currentParameters, ...$parameters])->value(),
$this->uri
)
)),
};
}
/**
* Remove query data according to their key name.
*/
public function removeQueryPairsByKey(string ...$keys): static
{
$query = Query::fromUri($this->uri);
$newQuery = $query->withoutPairByKey(...$keys)->value();
return match ($query->value()) {
$newQuery => $this,
default => new static($this->uri->withQuery(static::normalizeComponent($newQuery, $this->uri))),
};
}
/**
* Remove query pair according to their value.
*/
public function removeQueryPairsByValue(Stringable|string|int|float|bool|null ...$values): static
{
$query = Query::fromUri($this->uri);
$newQuery = $query->withoutPairByValue(...$values)->value();
return match ($query->value()) {
$newQuery => $this,
default => new static($this->uri->withQuery(static::normalizeComponent($newQuery, $this->uri))),
};
}
/**
* Remove query pair according to their key/value name.
*/
public function removeQueryPairsByKeyValue(string $key, Stringable|string|int|bool|null $value): static
{
$query = Query::fromUri($this->uri);
$newQuery = $query->withoutPairByKeyValue($key, $value)->value();
return match ($newQuery) {
$query->value() => $this,
default => new static($this->uri->withQuery(static::normalizeComponent($newQuery, $this->uri))),
};
}
/**
* Remove query data according to their PHP parameter key name.
*/
public function removeQueryParameters(string ...$keys): static
{
$query = Query::fromUri($this->uri);
$newQuery = $query->withoutParameters(...$keys)->value();
return match ($newQuery) {
$query->value() => $this,
default => new static($this->uri->withQuery(static::normalizeComponent($newQuery, $this->uri))),
};
}
/**
* Remove empty pairs from the URL query component.
*
* A pair is considered empty if it's name is the empty string
* and its value is either the empty string or the null value
*/
public function removeEmptyQueryPairs(): static
{
return new static($this->uri->withQuery(
static::normalizeComponent(
Query::fromUri($this->uri)->withoutEmptyPairs()->value(),
$this->uri
)
));
}
/**
* Returns an instance where numeric indices associated to PHP's array like key are removed.
*
* This method MUST retain the state of the current instance, and return
* an instance that contains the query component normalized so that numeric indexes
* are removed from the pair key value.
*
* ie.: toto[3]=bar[3]&foo=bar becomes toto[]=bar[3]&foo=bar
*/
public function removeQueryParameterIndices(): static
{
$query = Query::fromUri($this->uri);
$newQuery = $query->withoutNumericIndices()->value();
return match ($newQuery) {
$query->value() => $this,
default => new static($this->uri->withQuery(static::normalizeComponent($newQuery, $this->uri))),
};
}
/*********************************
* Host modifier methods
*********************************/
/**
* Add the root label to the URI.
*/
public function addRootLabel(): static
{
$host = $this->uri->getHost();
return match (true) {
null === $host,
str_ends_with($host, '.') => $this,
default => new static($this->uri->withHost($host.'.')),
};
}
/**
* Append a label or a host to the current URI host.
*
* @throws SyntaxError If the host cannot be appended
*/
public function appendLabel(Stringable|string|null $label): static
{
$host = Host::fromUri($this->uri);
$label = Host::new($label);
return match (true) {
null === $label->value() => $this,
$host->isDomain() => new static($this->uri->withHost(static::normalizeComponent(Domain::new($host)->append($label)->toUnicode(), $this->uri))),
$host->isIpv4() => new static($this->uri->withHost($host->value().'.'.ltrim($label->value(), '.'))),
default => throw new SyntaxError('The URI host '.$host->toString().' cannot be appended.'),
};
}
/**
* Convert the URI host part to its ascii value.
*/
public function hostToAscii(): static
{
$currentHost = $this->uri->getHost();
$host = IdnConverter::toAsciiOrFail((string) $currentHost);
return match (true) {
null === $currentHost,
'' === $currentHost,
$host === $currentHost => $this,
default => new static($this->uri->withHost($host)),
};
}
/**
* Convert the URI host part to its unicode value.
*/
public function hostToUnicode(): static
{
$currentHost = $this->uri->getHost();
$host = IdnConverter::toUnicode((string) $currentHost)->domain();
return match (true) {
null === $currentHost,
'' === $currentHost,
$host === $currentHost => $this,
default => new static($this->uri->withHost($host)),
};
}
/**
* Normalizes the URI host content to a IPv4 dot-decimal notation if possible
* otherwise returns the uri instance unchanged.
*
* @see https://url.spec.whatwg.org/#concept-ipv4-parser
*/
public function hostToDecimal(): static
{
$currentHost = $this->uri->getHost();
$hostIp = self::ipv4Converter()->toDecimal($currentHost);
return match (true) {
null === $currentHost,
'' === $currentHost,
null === $hostIp,
$currentHost === $hostIp => $this,
default => new static($this->uri->withHost($hostIp)),
};
}
/**
* Normalizes the URI host content to a IPv4 octal notation if possible
* otherwise returns the uri instance unchanged.
*
* @see https://url.spec.whatwg.org/#concept-ipv4-parser
*/
public function hostToOctal(): static
{
$currentHost = $this->uri->getHost();
$hostIp = self::ipv4Converter()->toOctal($currentHost);
return match (true) {
null === $currentHost,
'' === $currentHost,
null === $hostIp,
$currentHost === $hostIp => $this,
default => new static($this->uri->withHost($hostIp)),
};
}
/**
* Normalizes the URI host content to a IPv4 octal notation if possible
* otherwise returns the uri instance unchanged.
*
* @see https://url.spec.whatwg.org/#concept-ipv4-parser
*/
public function hostToHexadecimal(): static
{
$currentHost = $this->uri->getHost();
$hostIp = self::ipv4Converter()->toHexadecimal($currentHost);
return match (true) {
null === $currentHost,
'' === $currentHost,
null === $hostIp,
$currentHost === $hostIp => $this,
default => new static($this->uri->withHost($hostIp)),
};
}
public function hostToIpv6Compressed(): static
{
return new static($this->uri->withHost(
Converter::compress($this->uri->getHost())
));
}
public function hostToIpv6Expanded(): static
{
return new static($this->uri->withHost(
Converter::expand($this->uri->getHost())
));
}
/**
* Prepend a label or a host to the current URI host.
*
* @throws SyntaxError If the host cannot be prepended
*/
public function prependLabel(Stringable|string|null $label): static
{
$host = Host::fromUri($this->uri);
$label = Host::new($label);
return match (true) {
null === $label->value() => $this,
$host->isIpv4() => new static($this->uri->withHost(rtrim($label->value(), '.').'.'.$host->value())),
$host->isDomain() => new static($this->uri->withHost(static::normalizeComponent(Domain::new($host)->prepend($label)->toUnicode(), $this->uri))),
default => throw new SyntaxError('The URI host '.$host->toString().' cannot be prepended.'),
};
}
/**
* Remove host labels according to their offset.
*/
public function removeLabels(int ...$keys): static
{
return new static($this->uri->withHost(
static::normalizeComponent(
Domain::fromUri($this->uri)->withoutLabel(...$keys)->toUnicode(),
$this->uri
)
));
}
/**
* Remove the root label to the URI.
*/
public function removeRootLabel(): static
{
$host = $this->uri->getHost();
return match (true) {
null === $host,
'' === $host,
!str_ends_with($host, '.') => $this,
default => new static($this->uri->withHost(substr($host, 0, -1))),
};
}
/**
* Slice the host from the URI.
*/
public function sliceLabels(int $offset, ?int $length = null): static
{
$currentHost = $this->uri->getHost();
$host = Domain::new($currentHost)->slice($offset, $length);
return match (true) {
$host->value() === $currentHost,
$host->toUnicode() === $currentHost => $this,
default => new static($this->uri->withHost($host->toUnicode())),
};
}
/**
* Remove the host zone identifier.
*/
public function removeZoneId(): static
{
$host = Host::fromUri($this->uri);
return match (true) {
$host->hasZoneIdentifier() => new static($this->uri->withHost(
static::normalizeComponent(
Host::fromUri($this->uri)->withoutZoneIdentifier()->value(),
$this->uri
)
)),
default => $this,
};
}
/**
* Replace a label of the current URI host.
*/
public function replaceLabel(int $offset, Stringable|string|null $label): static
{
return new static($this->uri->withHost(
static::normalizeComponent(
Domain::fromUri($this->uri)->withLabel($offset, $label)->toUnicode(),
$this->uri
)
));
}
/*********************************
* Path modifier methods
*********************************/
/**
* Add a new base path to the URI path.
*/
public function addBasePath(Stringable|string $path): static
{
/** @var HierarchicalPath $path */
$path = HierarchicalPath::new($path)->withLeadingSlash();
/** @var HierarchicalPath $currentPath */
$currentPath = HierarchicalPath::fromUri($this->uri)->withLeadingSlash();
return new static(match (true) {
!str_starts_with($currentPath->toString(), $path->toString()) => $this->uri->withPath($path->append($currentPath)->toString()),
default => static::normalizePath($this->uri, $currentPath),
});
}
/**
* Add a leading slash to the URI path.
*/
public function addLeadingSlash(): static
{
$path = $this->uri->getPath();
return match (true) {
str_starts_with($path, '/') => $this,
default => new static($this->uri->withPath('/'.$path)),
};
}
/**
* Add a trailing slash to the URI path.
*/
public function addTrailingSlash(): static
{
$path = $this->uri->getPath();
return match (true) {
str_ends_with($path, '/') => $this,
default => new static($this->uri->withPath($path.'/')),
};
}
/**
* Append a new segment or a new path to the URI path.
*/
public function appendSegment(Stringable|string $segment): static
{
return new static(static::normalizePath($this->uri, HierarchicalPath::fromUri($this->uri)->append($segment)));
}
/**
* Convert the Data URI path to its ascii form.
*/
public function dataPathToAscii(): static
{
return new static($this->uri->withPath(DataPath::fromUri($this->uri)->toAscii()->toString()));
}
/**
* Convert the Data URI path to its binary (base64encoded) form.
*/
public function dataPathToBinary(): static
{
return new static($this->uri->withPath(DataPath::fromUri($this->uri)->toBinary()->toString()));
}
/**
* Prepend a new segment or a new path to the URI path.
*/
public function prependSegment(Stringable|string $segment): static
{
return new static(static::normalizePath($this->uri, HierarchicalPath::fromUri($this->uri)->prepend($segment)));
}
/**
* Remove a base path from the URI path.
*/
public function removeBasePath(Stringable|string $path): static
{
$basePath = HierarchicalPath::new($path)->withLeadingSlash()->toString();
$currentPath = HierarchicalPath::fromUri($this->uri)->withLeadingSlash()->toString();
$newPath = substr($currentPath, strlen($basePath));
return match (true) {
'/' === $basePath,
!str_starts_with($currentPath, $basePath),
!str_starts_with($newPath, '/') => $this,
default => new static($this->uri->withPath($newPath)),
};
}
/**
* Remove dot segments from the URI path.
*/
public function removeDotSegments(): static
{
return new static($this->uri->withPath(Path::fromUri($this->uri)->withoutDotSegments()->toString()));
}
/**
* Remove empty segments from the URI path.
*/
public function removeEmptySegments(): static
{
return new static($this->uri->withPath(HierarchicalPath::fromUri($this->uri)->withoutEmptySegments()->toString()));
}
/**
* Remove the leading slash from the URI path.
*/
public function removeLeadingSlash(): static
{
return new static(static::normalizePath($this->uri, Path::fromUri($this->uri)->withoutLeadingSlash()));
}
/**
* Remove the trailing slash from the URI path.
*/
public function removeTrailingSlash(): static
{
$path = $this->uri->getPath();
return match (true) {
!str_ends_with($path, '/') => $this,
default => new static($this->uri->withPath(substr($path, 0, -1))),
};
}
/**
* Remove path segments from the URI path according to their offsets.
*/
public function removeSegments(int ...$keys): static
{
return new static($this->uri->withPath(HierarchicalPath::fromUri($this->uri)->withoutSegment(...$keys)->toString()));
}
/**
* Replace the URI path basename.
*/
public function replaceBasename(Stringable|string $basename): static
{
return new static(static::normalizePath($this->uri, HierarchicalPath::fromUri($this->uri)->withBasename($basename)));
}
/**
* Replace the data URI path parameters.
*/
public function replaceDataUriParameters(Stringable|string $parameters): static
{
return new static($this->uri->withPath(DataPath::fromUri($this->uri)->withParameters($parameters)->toString()));
}
/**
* Replace the URI path dirname.
*/
public function replaceDirname(Stringable|string $dirname): static
{
return new static(static::normalizePath($this->uri, HierarchicalPath::fromUri($this->uri)->withDirname($dirname)));
}
/**
* Replace the URI path basename extension.
*/
public function replaceExtension(Stringable|string $extension): static
{
return new static($this->uri->withPath(HierarchicalPath::fromUri($this->uri)->withExtension($extension)->toString()));
}
/**
* Replace a segment from the URI path according its offset.
*/
public function replaceSegment(int $offset, Stringable|string $segment): static
{
return new static($this->uri->withPath(HierarchicalPath::fromUri($this->uri)->withSegment($offset, $segment)->toString()));
}
/**
* Slice the host from the URI.
*/
public function sliceSegments(int $offset, ?int $length = null): static
{
return new static(static::normalizePath($this->uri, HierarchicalPath::fromUri($this->uri)->slice($offset, $length)));
}
/**
* Normalize a URI path.
*
* Make sure the path always has a leading slash if an authority is present
* and the path is not the empty string.
*/
final protected static function normalizePath(Psr7UriInterface|UriInterface $uri, PathInterface $path): Psr7UriInterface|UriInterface
{
$pathString = $path->toString();
$authority = $uri->getAuthority();
return match (true) {
'' === $pathString,
'/' === $pathString[0],
null === $authority,
'' === $authority => $uri->withPath($pathString),
default => $uri->withPath('/'.$pathString),
};
}
/**
* Normalize the URI component value depending on the subject interface.
*
* null value MUST be converted to the empty string if a Psr7 UriInterface is being manipulated.
*/
final protected static function normalizeComponent(?string $component, Psr7UriInterface|UriInterface $uri): ?string
{
return match (true) {
$uri instanceof Psr7UriInterface => (string) $component,
default => $component,
};
}
final protected static function ipv4Converter(): IPv4Converter
{
static $converter;
$converter = $converter ?? IPv4Converter::fromEnvironment();
return $converter;
}
/**
* DEPRECATION WARNING! This method will be removed in the next major point release.
*
* @deprecated Since version 7.2.0
* @codeCoverageIgnore
* @see Modifier::removeQueryParameters()
*
* Remove query data according to their key name.
*/
#[Deprecated(message:'use League\Uri\Modifier::removeQueryParameters() instead', since:'league/uri-components:7.2.0')]
public function removeParams(string ...$keys): static
{
return $this->removeQueryParameters(...$keys);
}
/**
* DEPRECATION WARNING! This method will be removed in the next major point release.
*
* @deprecated Since version 7.2.0
* @codeCoverageIgnore
* @see Modifier::removeEmptyQueryPairs()
*
* Remove empty pairs from the URL query component.
*
* A pair is considered empty if it's name is the empty string
* and its value is either the empty string or the null value
*/
#[Deprecated(message:'use League\Uri\Modifier::removeEmptyQueryPairs() instead', since:'league/uri-components:7.2.0')]
public function removeEmptyPairs(): static
{
return $this->removeEmptyQueryPairs();
}
/**
* DEPRECATION WARNING! This method will be removed in the next major point release.
*
* @deprecated Since version 7.2.0
* @codeCoverageIgnore
* @see Modifier::removeQueryPairsByKey()
*
* Remove query data according to their key name.
*/
#[Deprecated(message:'use League\Uri\Modifier::removeQueryPairsByKey() instead', since:'league/uri-components:7.2.0')]
public function removePairs(string ...$keys): static
{
return $this->removeQueryPairsByKey(...$keys);
}
/**
* DEPRECATION WARNING! This method will be removed in the next major point release.
*
* @deprecated Since version 7.2.0
* @codeCoverageIgnore
* @see Modifier::removeQueryPairsByKey()
*
* Remove query data according to their key name.
*/
#[Deprecated(message:'use League\Uri\Modifier::removeQueryPairsByKey() instead', since:'league/uri-components:7.2.0')]
public function removeQueryPairs(string ...$keys): static
{
return $this->removeQueryPairsByKey(...$keys);
}
}
|