ValidIntegerValidator::isValidInteger()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Andegna\Validator;
4
5
/**
6
 * Class ValidIntegerValidator.
7
 */
8
trait ValidIntegerValidator
9
{
10
    /**
11
     * @param array $integers a list of integers
12
     *
13
     * @return bool returns true if all the elements in the array are integer
14
     */
15
    public function isValidInteger(...$integers): bool
16
    {
17 187
        return array_reduce($integers, function ($carry, $integer) {
18 187
            return $carry && is_int($integer);
19 187
        }, true);
20
    }
21
}
22