Number   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 13
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 36
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A is_numeric() 0 4 1
A is_int() 0 4 1
A is_float() 0 4 1
A less_than() 0 4 2
A greater_than() 0 4 2
B in_range() 0 8 6
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
}