public static function getProtocol()
{
return self::_isServerVariableSetAndHasValue('HTTPS', array('on', 1)) || self::_isServerVariableSetAndHasValue('HTTP_X_FORWARDED_PROTO', 'https') ? 'https://' : 'http://';
}
/** * @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); }