Number::in_range()   B
last analyzed

Complexity

Conditions 6
Paths 6

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 8.8571
cc 6
eloc 4
nc 6
nop 4
1
<?php
2
3
namespace Amarkal\Validation;
4
5
class Number
6
{
7
    static function is_numeric( $num )
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
8
    {
9
        return \is_numeric($num);
10
    }
11
    
12
    static function is_int( $num )
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
13
    {
14
        return \is_int($num);
15
    }
16
    
17
    static function is_float( $num )
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
18
    {
19
        return \is_float($num);
20
    }
21
    
22
    static function less_than( $num, $limit )
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
23
    {
24
        return self::is_numeric($num) && $num < $limit;
25
    }
26
    
27
    static function greater_than( $num, $limit )
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
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
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
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
}