Converts the relative URI into a new URI that is resolved against the base URI.
public static resolve ( Psr\Http\Message\UriInterface $base, Psr\Http\Message\UriInterface $rel ) : Psr\Http\Message\UriInterface | ||
$base | Psr\Http\Message\UriInterface | Base URI |
$rel | Psr\Http\Message\UriInterface | Relative URI |
리턴 | Psr\Http\Message\UriInterface |
/** * @dataProvider getRelativizeTestCases */ public function testRelativizeUriWithUniqueTests($base, $target, $expectedRelativeReference) { $baseUri = new Uri($base); $targetUri = new Uri($target); $relativeUri = UriResolver::relativize($baseUri, $targetUri); $this->assertInstanceOf('Psr\\Http\\Message\\UriInterface', $relativeUri); $this->assertSame($expectedRelativeReference, (string) $relativeUri); $this->assertSame((string) UriResolver::resolve($baseUri, $targetUri), (string) UriResolver::resolve($baseUri, $relativeUri)); }
/** * Converts the relative URI into a new URI that is resolved against the base URI. * * @param UriInterface $base Base URI * @param string|UriInterface $rel Relative URI * * @return UriInterface * * @deprecated since version 1.4. Use UriResolver::resolve instead. * @see UriResolver::resolve */ public static function resolve(UriInterface $base, $rel) { if (!$rel instanceof UriInterface) { $rel = new self($rel); } return UriResolver::resolve($base, $rel); }