| Conditions | 4 |
| Paths | 8 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4 |
| 1 | <?php |
||
| 89 | 1 | protected function createUrlFromServerArray(array $server, bool $secure = true): string |
|
| 90 | { |
||
| 91 | 1 | $protocol = $secure ? 'https' : 'http'; |
|
| 92 | 1 | $host = !empty($server['HTTP_HOST']) ? $server['HTTP_HOST'] : 'www.example.com'; |
|
| 93 | 1 | $path = !empty($server['REQUEST_URI']) ? $server['REQUEST_URI'] : ''; |
|
| 94 | |||
| 95 | 1 | $url = "$protocol://$host$path"; |
|
| 96 | |||
| 97 | 1 | return rtrim($url, '/'); |
|
| 98 | } |
||
| 99 | } |
||
| 100 |