public function setHost($host) { if (preg_match(self::PATTERN_MATCH_HOST, $host) === 1) { $this->host = $host; } else { throw new \InvalidArgumentException('"' . $host . '" is not valid host as part of a URI.', 1184071240); } }
/** * @test * @expectedException \InvalidArgumentException */ public function settingInvalidHostThrowsException() { $uri = new Uri(''); $uri->setHost('an#invalid.host'); }