Passed
Push — master ( 1c8d05...42c076 )
by Enjoys
01:48
created

Helpers   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
c 1
b 0
f 1
dl 0
loc 18
ccs 9
cts 9
cp 1
rs 10
wmc 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A getHttpScheme() 0 15 6
1
<?php
2
3
4
namespace Enjoys\AssetsCollector;
5
6
7
class Helpers
8
{
9
10 15
    static public function getHttpScheme(): string
11
    {
12 15
        $scheme = 'http';
13 15
        if (isset($_SERVER['HTTP_SCHEME'])) {
14 1
            return $_SERVER['HTTP_SCHEME'];
15
        }
16
17 14
        if (isset($_SERVER['HTTPS']) && \strtolower($_SERVER['HTTPS']) != 'off') {
18 1
            return 'https';
19
        }
20
21 13
        if (isset($_SERVER['SERVER_PORT']) && 443 == $_SERVER['SERVER_PORT']) {
22 1
            return 'https';
23
        }
24 12
        return $scheme;
25
    }
26
}