Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
8 | public function __construct(){ |
||
|
|||
9 | $this->requestUri = $_SERVER['REQUEST_URI']; |
||
10 | $tmp = explode('/',$this->requiestUri); |
||
11 | foreach($tmp as $key=>$value){ |
||
12 | $value = trim($value); |
||
13 | if(empty($value)) unset($tmp[$key]); |
||
14 | else $tmp[$key] = $value; |
||
15 | } |
||
16 | $tmp = array_values($tmp); |
||
17 | $this->requestUri = $tmp; |
||
18 | } |
||
19 | |||
35 |
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: