getScheme() public method

Returns the URI's scheme / protocol
public getScheme ( ) : string
return string URI scheme / protocol
Ejemplo n.º 1
0
 /**
  * @test
  */
 public function constructorParsesArgumentsWithSpecialCharactersCorrectly()
 {
     $uriString = 'http://www.neos.io/path1/?argumentäöü1=' . urlencode('valueåø€œ');
     $uri = new Uri($uriString);
     $check = $uri->getScheme() == 'http' && $uri->getHost() == 'www.neos.io' && $uri->getPath() == '/path1/' && $uri->getQuery() == 'argumentäöü1=value%C3%A5%C3%B8%E2%82%AC%C5%93' && $uri->getArguments() == ['argumentäöü1' => 'valueåø€œ'];
     $this->assertTrue($check, 'The URI with special arguments has not been correctly transformed to an URI object');
 }
Ejemplo n.º 2
0
 /**
  * Indicates if this request has been received through a secure channel.
  *
  * @return boolean
  * @api
  */
 public function isSecure()
 {
     return $this->uri->getScheme() === 'https';
 }
 /**
  * @param string|Uri $uri
  * @return string
  */
 public function getScheme($uri)
 {
     if ($uri instanceof Uri) {
         return $uri->getScheme();
     }
     if (preg_match(self::PATTERN_SUPPORTED_URIS, $uri, $matches) === 1) {
         return $matches[1];
     }
     return '';
 }