GreaterThan   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
dl 0
loc 40
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B shouldRun() 0 11 5
1
<?php
2
namespace pmill\RabbitRabbit\Conditions;
3
4
class GreaterThan implements ConditionInterface
5
{
6
    /**
7
     * @var int
8
     */
9
    protected $greaterThan;
10
11
    /**
12
     * @var bool
13
     */
14
    protected $inclusive = false;
15
16
    /**
17
     * GreaterThan constructor.
18
     *
19
     * @param int $greaterThan
20
     * @param bool $inclusive
21
     */
22 7
    public function __construct(int $greaterThan, bool $inclusive = false)
23
    {
24 7
        $this->greaterThan = $greaterThan;
25 7
        $this->inclusive = $inclusive;
26 7
    }
27
28
    /**
29
     * @param int $value
30
     *
31
     * @return bool
32
     */
33 6
    public function shouldRun($value)
34
    {
35 6
        if ($this->inclusive && $value >= $this->greaterThan) {
36 2
            return true;
37
        }
38
39 4
        if (!$this->inclusive && $value > $this->greaterThan) {
40 2
            return true;
41
        }
42
43 2
        return false;
44
    }
45
}
46