Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
52 | public function protocol(string $default = 'https'): string |
||
53 | { |
||
54 | $protocol = $this->server('HTTP_CF_VISITOR'); // cloudFlare |
||
55 | |||
56 | if ($protocol) |
||
57 | { |
||
58 | /** |
||
59 | * { scheme: "https" } |
||
60 | * |
||
61 | * @var string $protocol |
||
62 | */ |
||
63 | $protocol = json_decode($protocol, true); |
||
64 | } |
||
65 | |||
66 | return $protocol['scheme'] ?? |
||
67 | $this->server( |
||
68 | 'HTTP_X_FORWARDED_PROTO', |
||
69 | $this->server('REQUEST_SCHEME', $default) |
||
70 | ); |
||
90 |