Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
9 | View Code Duplication | function URL() |
|
10 | { |
||
11 | $http = "http://"; |
||
12 | @$host = $_SERVER['SERVER_NAME']; |
||
13 | @$port = $_SERVER['SERVER_PORT']; |
||
14 | $fol = ""; |
||
15 | if(@$_SERVER['SERVER_ADDR']!=NULL) |
||
16 | { |
||
17 | $fol = "/".explode('/', $_SERVER['PHP_SELF'])[1]; |
||
18 | } |
||
19 | $url = $http.$host.":".$port.$fol; |
||
20 | return $url; |
||
21 | } |
||
22 | |||
23 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: