Neos\Flow\Http\Uri::setScheme PHP Метод

setScheme() публичный Метод

Sets the URI's scheme / protocol
public setScheme ( string $scheme ) : void
$scheme string The scheme. Allowed values are "http" and "https"
Результат void
    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);
        }
    }

Usage Example

Пример #1
0
 /**
  * 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);
 }