public function expandBase(UriInterface $uri, UriInterface $base)
{
if ($uri->getScheme() !== '') {
if (strpos((string) $uri, (string) $base) !== 0) {
throw new \UnexpectedValueException('Invalid base, "' . $uri . '" does not appear to be below "' . $base . '"');
}
return $uri;
}
$uri = (string) $uri;
$base = (string) $base;
if ($uri !== '' && substr($base, -1) !== '/' && substr($uri, 0, 1) !== '?') {
$base .= '/';
}
if (isset($uri[0]) && $uri[0] === '/') {
$uri = substr($uri, 1);
}
return $this->uri($base . $uri);
}