/** * If the $url is a relative URL, will attempt to create * a full URL by prepending $this->baseURI to it. * * @param string $url * * @return string */ protected function prepareURL(string $url) : string { // If it's a full URI, then we have nothing to do here... if (strpos($url, '://') !== false) { return $url; } $uri = $this->baseURI->resolveRelativeURI($url); return (string) $uri; }
/** * @dataProvider defaultResolutions */ public function testResolveRelativeURI($rel, $expected) { $base = 'http://a/b/c/d'; $uri = new URI($base); $new = $uri->resolveRelativeURI($rel); $this->assertEquals($expected, (string) $new); }