Esempio n. 1
0
 /**
  * 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;
 }
Esempio n. 2
0
 /**
  * @dataProvider constructorAndComponentsDataProvider
  */
 public function testConstructorAndGetComponents($url, $expected_components)
 {
     $url_parser = new Parser($url);
     $this->assertEquals($expected_components, $url_parser->getComponents());
 }