Completed
Push — master ( 929034...adc5e6 )
by Marcus
02:23
created

AbstractIntegerCase::isInteger()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Mbright\Validation\Rule\Validate;
4
5
class AbstractIntegerCase
6
{
7
    /**
8
     * Indicates if the given value is an integer.
9
     *
10
     * @param $value
11
     *
12
     * @return bool
13
     */
14 198
    protected function isInteger($value): bool
15
    {
16 198
        return is_int($value);
17
    }
18
19
    /**
20
     * Indicates if the given value is numeric.
21
     *
22
     * @param $value
23
     *
24
     * @return bool
25
     */
26 54
    protected function isNumeric($value): bool
27
    {
28 54
        return is_numeric($value) && $value == (int) $value;
29
    }
30
31
    /**
32
     * Indicates if the given value is an integer or numeric.
33
     *
34
     * @param $value
35
     *
36
     * @return bool
37
     */
38 33
    protected function isIntOrNumeric($value): bool
39
    {
40 33
        return $this->isInteger($value) || $this->isNumeric($value);
41
    }
42
}
43