public function setScheme($scheme) { if (preg_match(self::PATTERN_MATCH_SCHEME, $scheme) === 1) { $this->scheme = strtolower($scheme); } else { throw new \InvalidArgumentException('"' . $scheme . '" is not a valid scheme.', 1184071237); } }
/** * Checks round trips for various URIs * * @test */ public function settingSchemeAndHostOnUriDoesNotConfuseToString() { $uri = new Uri('/no/scheme/or/host'); $uri->setScheme('http'); $uri->setHost('localhost'); $this->assertSame('http://localhost/no/scheme/or/host', (string) $uri); }