GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

NumericComparison   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 49
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isEqual() 0 4 1
A isLesserThan() 0 8 2
A isGreaterThan() 0 8 2
1
<?php
2
3
namespace PhpAbac\Comparison;
4
5
class NumericComparison extends AbstractComparison
6
{
7
    /**
8
     * @param int $expected
9
     * @param int $value
10
     *
11
     * @return bool
12
     */
13 1
    public function isEqual($expected, $value)
14
    {
15 1
        return (int) $expected === (int) $value;
16
    }
17
18
    /**
19
     * If strict is set to false, equal values will return true.
20
     * 
21
     * @param int  $expected
22
     * @param int  $value
23
     * @param bool $strict
24
     *
25
     * @return bool
26
     */
27 1
    public function isLesserThan($expected, $value, $strict = true)
28
    {
29
        return
30 1
            ($strict === true)
31 1
            ? $expected > $value
32 1
            : $expected >= $value
33 1
        ;
34
    }
35
36
    /**
37
     * If strict is set to false, equal values will return true.
38
     * 
39
     * @param int  $expected
40
     * @param int  $value
41
     * @param bool $strict
42
     *
43
     * @return bool
44
     */
45 5
    public function isGreaterThan($expected, $value, $strict = true)
46
    {
47
        return
48 5
            ($strict === true)
49 5
            ? $expected < $value
50 1
            : $expected <= $value
51 5
        ;
52
    }
53
}
54