protected function doParseUrl($url)
{
// If there's a single leading forward slash, use parse_url()
// Expected matches:
//
// "/one/two" YES
// "/" YES PLEASE
// "//" NO
// "//one/two" NO
// "" HELL NO
if (preg_match('#^[\\/]([^\\/]|$)#', $url) === 1) {
return parse_url($url);
} else {
// Otherwise use the PSL parser
return $this->pslParser->parseUrl($url)->toArray();
}
}