/** * Returns normalized url. * * @param PageUrlAnnotation $annotation The page url annotation. * * @return array */ public function normalize(PageUrlAnnotation $annotation) { $parser = new Parser($this->baseUrl); $parser->merge(new Parser($annotation->url)); $parser->setParams(array_merge($parser->getParams(), $annotation->params)); $ret = $parser->getComponents(); if ($annotation->secure !== null && !empty($ret['scheme'])) { $ret['scheme'] = $annotation->secure ? 'https' : 'http'; } return $ret; }
/** * @dataProvider constructorAndComponentsDataProvider */ public function testConstructorAndGetComponents($url, $expected_components) { $url_parser = new Parser($url); $this->assertEquals($expected_components, $url_parser->getComponents()); }