NumberChecker::isIntValue()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arcanedev\Gravatar\Helpers;
6
7
/**
8
 * Class     NumberChecker
9
 *
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class NumberChecker
13
{
14
    /* -----------------------------------------------------------------
15
     |  Main Methods
16
     | -----------------------------------------------------------------
17
     */
18
19
    /**
20
     * Check if an integer is between two values.
21
     *
22
     * @param  int  $value
23
     * @param  int  $min
24
     * @param  int  $max
25
     *
26
     * @return bool
27
     */
28 76
    public static function isIntBetween(int $value, int $min, int $max): bool
29
    {
30 76
        return $value >= $min && $value <= $max;
31
    }
32
33
    /**
34
     * Check if value is integer.
35
     *
36
     * @param  mixed  $value
37
     *
38
     * @return bool
39
     */
40 76
    public static function isIntValue($value): bool
41
    {
42 76
        return is_int($value) || ctype_digit($value);
43
    }
44
}
45