UriResolver.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * League.Uri (https://uri.thephpleague.com)
  4. *
  5. * (c) Ignace Nyamagana Butera <nyamsprod@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. declare(strict_types=1);
  11. namespace League\Uri;
  12. use Deprecated;
  13. use League\Uri\Contracts\UriInterface;
  14. use Psr\Http\Message\UriInterface as Psr7UriInterface;
  15. /**
  16. * @deprecated since version 7.0.0
  17. * @codeCoverageIgnore
  18. * @see BaseUri
  19. */
  20. final class UriResolver
  21. {
  22. /**
  23. * Resolves a URI against a base URI using RFC3986 rules.
  24. *
  25. * This method MUST retain the state of the submitted URI instance, and return
  26. * a URI instance of the same type that contains the applied modifications.
  27. *
  28. * This method MUST be transparent when dealing with error and exceptions.
  29. * It MUST not alter or silence them apart from validating its own parameters.
  30. */
  31. #[Deprecated(message:'use League\Uri\BaseUri::resolve() instead', since:'league/uri:7.0.0')]
  32. public static function resolve(Psr7UriInterface|UriInterface $uri, Psr7UriInterface|UriInterface $baseUri): Psr7UriInterface|UriInterface
  33. {
  34. return BaseUri::from($baseUri)->resolve($uri)->getUri();
  35. }
  36. /**
  37. * Relativizes a URI according to a base URI.
  38. *
  39. * This method MUST retain the state of the submitted URI instance, and return
  40. * a URI instance of the same type that contains the applied modifications.
  41. *
  42. * This method MUST be transparent when dealing with error and exceptions.
  43. * It MUST not alter or silence them apart from validating its own parameters.
  44. */
  45. #[Deprecated(message:'use League\Uri\BaseUri::relativize() instead', since:'league/uri:7.0.0')]
  46. public static function relativize(Psr7UriInterface|UriInterface $uri, Psr7UriInterface|UriInterface $baseUri): Psr7UriInterface|UriInterface
  47. {
  48. return BaseUri::from($baseUri)->relativize($uri)->getUri();
  49. }
  50. }