public function getUrl($name, $path = '', $params = [])
{
$url = self::$domainMap[$name];
if ($path) {
if ($path[0] === '/') {
$path = substr($path, 1);
}
$url .= $path;
}
if (!empty($params)) {
// does it exist a query string?
$queryString = parse_url($url, PHP_URL_QUERY);
if (empty($queryString)) {
$url .= '?';
} else {
$url .= '&';
}
// it needs to be PHP_QUERY_RFC3986. We want to have %20 between scopes
$url .= http_build_query($params, null, '&', PHP_QUERY_RFC3986);
}
return $url;
}