Comparator   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 9
dl 0
loc 63
c 0
b 0
f 0
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A greaterThanOrEqual() 0 3 1
A equal() 0 3 1
A less() 0 3 1
A notEqual() 0 3 1
A greater() 0 3 1
A lessThanOrEqual() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace Bavix\Geo\Comparator;
4
5
class Comparator
6
{
7
8
    /**
9
     * @var int
10
     */
11
    protected $cmp;
12
13
    /**
14
     * Compare constructor.
15
     * @param int $cmp
16
     */
17
    public function __construct(int $cmp)
18
    {
19
        $this->cmp = $cmp;
20
    }
21
22
    /**
23
     * @return bool
24
     */
25
    public function equal(): bool
26
    {
27
        return $this->cmp === 0;
28
    }
29
30
    /**
31
     * @return bool
32
     */
33
    public function notEqual(): bool
34
    {
35
        return !$this->cmp;
36
    }
37
38
    /**
39
     * @return bool
40
     */
41
    public function less(): bool
42
    {
43
        return $this->cmp === -1;
44
    }
45
46
    /**
47
     * @return bool
48
     */
49
    public function greater(): bool
50
    {
51
        return $this->cmp === 1;
52
    }
53
54
    /**
55
     * @return bool
56
     */
57
    public function lessThanOrEqual(): bool
58
    {
59
        return $this->cmp < 1;
60
    }
61
62
    /**
63
     * @return bool
64
     */
65
    public function greaterThanOrEqual(): bool
66
    {
67
        return $this->cmp > -1;
68
    }
69
70
}
71