1 | <?php |
||
7 | class URI |
||
8 | { |
||
9 | /** |
||
10 | * Retrieve the parameters from the URI |
||
11 | * |
||
12 | * @param string $uri The URI |
||
13 | * @param boolean $serialized It's to be serialized? |
||
14 | * @return mixed |
||
15 | */ |
||
16 | public static function getQueryParams($uri, $serialized = true) |
||
36 | |||
37 | /** |
||
38 | * Returns the query params as an associative array |
||
39 | * |
||
40 | * @param string $params The query parameters |
||
41 | * @return array |
||
42 | */ |
||
43 | public static function deserializeQueryParams($params) |
||
63 | |||
64 | /** |
||
65 | * Serializes the query params |
||
66 | * |
||
67 | * @param array $queryParams The query params |
||
68 | * @return string |
||
69 | */ |
||
70 | public static function serializeQueryParams(array $queryParams) |
||
79 | |||
80 | /** |
||
81 | * Check query parameters validity |
||
82 | * |
||
83 | * @param string $params The query parameters |
||
84 | * @return boolean true if valid |
||
85 | */ |
||
86 | public static function isQueryParamsValid($params) |
||
96 | |||
97 | /** |
||
98 | * Percentage encode a query. |
||
99 | * |
||
100 | * @param string $query The query to be encoded. |
||
101 | * @return string |
||
102 | */ |
||
103 | public static function percentEncode($query) |
||
107 | |||
108 | public static function isQueryValid($query) |
||
116 | |||
117 | public static function isValid($uri) |
||
125 | |||
126 | /** |
||
127 | * Retrieve the fragment from the URI |
||
128 | * |
||
129 | * @param string $uri The URI |
||
130 | * @return string |
||
131 | */ |
||
132 | public static function getQueryFragment($uri) |
||
136 | |||
137 | /** |
||
138 | * Validates a port within TCP and UDP ranges. |
||
139 | * |
||
140 | * @param string $port The port |
||
141 | * @return boolean |
||
142 | */ |
||
143 | public static function isPortValid($port) |
||
147 | |||
148 | /** |
||
149 | * Validates a path. |
||
150 | * |
||
151 | * @param string $path The path |
||
152 | * @return boolean |
||
153 | */ |
||
154 | public static function isPathValid($path) |
||
158 | |||
159 | public function validator() |
||
170 | } |
||
171 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.