/** * returns port of the uri * * @param int $defaultPort parameter is ignored for http uris * @return int */ public function port(int $defaultPort = null) : int { if ($this->isHttp()) { return parent::port(Http::PORT); } return parent::port(Http::PORT_SSL); }
/** * @test * @since 5.5.0 */ public function withPathReturnsNewInstance() { $uri = Uri::fromString('http://example.org/foo'); assert($uri->withPath('/bar'), isNotSameAs($uri)); }