These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace humanity; |
||
3 | |||
4 | class Uri { |
||
5 | |||
6 | private $requestUri = ''; |
||
7 | |||
8 | public function __construct(){ |
||
9 | $this->requestUri = $_SERVER['REQUEST_URI']; |
||
10 | $tmp = explode('/',$this->requiestUri); |
||
0 ignored issues
–
show
|
|||
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 | |||
20 | public function full(){ |
||
21 | return '/'.implode('/',$this->requestUri); |
||
22 | } |
||
23 | |||
24 | public function part($number){ |
||
25 | if(isset($this->requestUri[$number])) return (string) urldecode($this->requestUri[$number]); |
||
26 | else return ''; |
||
27 | } |
||
28 | |||
29 | public function host(){ |
||
30 | return parse_url('http://'.$_SERVER['HTTP_HOST'])['host']; |
||
31 | } |
||
32 | |||
33 | } |
||
34 | ?> |
||
35 |
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.