| Conditions | 4 |
| Paths | 4 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 13 | public static function get($key, $type, $default) |
||
|
1 ignored issue
–
show
|
|||
| 14 | { |
||
| 15 | if (!isset($_GET[$key])) { |
||
| 16 | return $default; |
||
| 17 | } |
||
| 18 | if ($type == 'array') { |
||
| 19 | return !is_array($_GET[$key]) ? [] : $_GET[$key]; |
||
| 20 | } |
||
| 21 | return eval('return (' . $type . ') $_GET[$key];'); |
||
|
1 ignored issue
–
show
|
|||
| 22 | } |
||
| 23 | |||
| 25 |
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: