Ouzo\Uri::getProtocol PHP Method

getProtocol() public static method

public static getProtocol ( )
    public static function getProtocol()
    {
        return self::_isServerVariableSetAndHasValue('HTTPS', array('on', 1)) || self::_isServerVariableSetAndHasValue('HTTP_X_FORWARDED_PROTO', 'https') ? 'https://' : 'http://';
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @test
  * @dataProvider protocols
  * @param string $header
  * @param mixed $value
  * @param string $expected
  */
 public function shouldReturnCorrectProtocol($header, $value, $expected)
 {
     //given
     $_SERVER[$header] = $value;
     //when
     $protocol = Uri::getProtocol();
     //then
     $this->assertEquals($expected, $protocol);
 }