/** * Test that we get the correct userInfo * * @param string $uriString * @param array $parts * @dataProvider uriWithPartsProvider */ public function testGetUserInfo($uriString, $parts) { $uri = new Uri($uriString); if (isset($parts['userInfo'])) { $this->assertEquals($parts['userInfo'], $uri->getUserInfo()); } else { $this->assertNull($uri->getUserInfo()); } }
public function testParseTwice() { $uri = new Uri(); $uri->parse('http://user@example.com:1/absolute/url?query#fragment'); $uri->parse('/relative/url'); $this->assertNull($uri->getScheme()); $this->assertNull($uri->getHost()); $this->assertNull($uri->getUserInfo()); $this->assertNull($uri->getPort()); $this->assertNull($uri->getQuery()); $this->assertNull($uri->getFragment()); }
/** * @inheritdoc */ public function parse($uri) { $uri = new Uri($uri); return $this->formatResults(['scheme' => $uri->getScheme(), 'userinfo' => $uri->getUserInfo(), 'host' => $uri->getHost(), 'port' => $uri->getPort(), 'path' => $uri->getPath(), 'query' => $uri->getQuery(), 'fragment' => $uri->getFragment()]); }
/** * Get the User-info (usually user:password) part * * @return string|null */ public function getUserInfo() { return $this->uri->getUserInfo(); }