public static function fromUrl($url)
{
$elements = parse_url($url);
$elements['pathinfo'] = isset($elements['path']) ? $elements['path'] : '';
if (isset($elements['query'])) {
parse_str($elements['query'], $queryParams);
$elements['queryParams'] = $queryParams;
}
// Remove unwanted keys returned by parse_url() so that we don't have them as properties.
unset($elements['path'], $elements['query'], $elements['user'], $elements['pass'], $elements['fragment']);
return new static($elements);
}
public function testAnalyseLink() { $siteAccessURI = '/footestbar'; $semanticURI = '/something/hoho'; $matcher = new URITextMatcher(array('prefix' => 'foo', 'suffix' => 'bar')); $matcher->setRequest(SimplifiedRequest::fromUrl('http://phoenix-rises.fm/footestbar/blabla')); $this->assertSame($siteAccessURI . $semanticURI, $matcher->analyseLink($semanticURI)); }