AbstractCompareRule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 21
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A less() 0 6 2
1
<?php
2
3
/**
4
 * Bluz Framework Component
5
 *
6
 * @copyright Bluz PHP Team
7
 * @link      https://github.com/bluzphp/framework
8
 */
9
10
declare(strict_types=1);
11
12
namespace Bluz\Validator\Rule;
13
14
/**
15
 * Abstract rule of compare
16
 *
17
 * @package Bluz\Validator\Rule
18
 */
19
abstract class AbstractCompareRule extends AbstractRule
20
{
21
    /**
22
     * @var bool compare inclusive or not
23
     */
24
    protected $inclusive;
25
26
    /**
27
     * Check $what less $than or not
28
     *
29
     * @param  mixed $what
30
     * @param  mixed $than
31
     *
32
     * @return bool
33
     */
34 69
    protected function less($what, $than): bool
35
    {
36 69
        if ($this->inclusive) {
37 40
            return $what <= $than;
38
        }
39 29
        return $what < $than;
40
    }
41
}
42