These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Amarkal\Validation; |
||
4 | |||
5 | class Number |
||
6 | { |
||
7 | static function is_numeric( $num ) |
||
0 ignored issues
–
show
|
|||
8 | { |
||
9 | return \is_numeric($num); |
||
10 | } |
||
11 | |||
12 | static function is_int( $num ) |
||
0 ignored issues
–
show
|
|||
13 | { |
||
14 | return \is_int($num); |
||
15 | } |
||
16 | |||
17 | static function is_float( $num ) |
||
0 ignored issues
–
show
|
|||
18 | { |
||
19 | return \is_float($num); |
||
20 | } |
||
21 | |||
22 | static function less_than( $num, $limit ) |
||
0 ignored issues
–
show
|
|||
23 | { |
||
24 | return self::is_numeric($num) && $num < $limit; |
||
25 | } |
||
26 | |||
27 | static function greater_than( $num, $limit ) |
||
0 ignored issues
–
show
|
|||
28 | { |
||
29 | return self::is_numeric($num) && $num > $limit; |
||
30 | } |
||
31 | |||
32 | static function in_range( $num, $min, $max, $inclusive = false ) |
||
0 ignored issues
–
show
|
|||
33 | { |
||
34 | if($inclusive) |
||
35 | { |
||
36 | return self::is_numeric($num) && $num <= $max && $num >= $min; |
||
37 | } |
||
38 | return self::is_numeric($num) && $num < $max && $num > $min; |
||
39 | } |
||
40 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.