@@ -17,29 +17,34 @@ public static function get_config( string $name ): array {
17
17
return $ config ;
18
18
}
19
19
20
- public static function has_var ( string $ name , ?int $ input_type = null ): bool {
20
+ public static function has_var ( string $ var_name , ?int $ input_type = null ): bool {
21
21
if ( null === $ input_type ) {
22
22
try {
23
- list ( $ input_type , ) = self ::get_config ( $ name );
23
+ list ( $ input_type , ) = self ::get_config ( $ var_name );
24
24
} catch ( \InvalidArgumentException $ e ) {
25
25
return false ;
26
26
}
27
27
}
28
28
29
- return filter_has_var ( $ input_type , $ name );
29
+ return filter_has_var ( $ input_type , $ var_name );
30
30
}
31
31
32
32
/**
33
33
* @return mixed
34
34
*/
35
- public static function get_var ( string $ name , ?int $ input_type = null ) {
35
+ public static function get_var ( string $ var_name , ?int $ input_type = null ) {
36
36
try {
37
- list ($ type , $ filter ) = self ::get_config ( $ name );
37
+ list ($ type , $ filter ) = self ::get_config ( $ var_name );
38
38
} catch ( \InvalidArgumentException $ e ) {
39
39
return null ;
40
40
}
41
41
42
- return filter_input ( $ input_type ?? $ type , $ name , $ filter );
42
+ $ type = $ input_type ?? $ type ;
43
+ if ( in_array ( $ type , array ( INPUT_POST , INPUT_GET , INPUT_COOKIE , INPUT_ENV , INPUT_SERVER ), true ) ) {
44
+ return filter_input ( $ type , $ var_name , $ filter );
45
+ }
46
+
47
+ return null ;
43
48
}
44
49
45
50
/**
0 commit comments