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