getUrlForScheme() public method

Builds a URL with a different scheme
public getUrlForScheme ( $scheme ) : Url
return Url
Example #1
0
 public function testGetUrlForScheme()
 {
     // implicit default port
     $url = new Http\Url('http://example.org');
     $this->assertEquals('https://example.org/', (string) $url->getUrlForScheme('https'));
     // explicit default port
     $url = new Http\Url('http://example.org:80');
     $this->assertEquals('https://example.org/', (string) $url->getUrlForScheme('https'));
     // explicit non standard port
     $url = new Http\Url('http://example.org:123');
     $this->assertEquals('https://example.org:123/', (string) $url->getUrlForScheme('https'));
 }