Passed
Push — master ( 0ddee3...3f4370 )
by Sérgio
06:31
created

all.php ➔ all()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 1
nop 1
dl 0
loc 8
ccs 3
cts 3
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Prelude;
6
7
const all = __NAMESPACE__.'\all';
8
9
use Closure;
10
11
function all(callable $pred): Closure
12
{
13
    return function (array $xs) use ($pred): bool {
14
        return array_reduce($xs, function (bool $prev, $x) use ($pred) {
15 1
            return $prev && $pred($x);
16 1
        }, true);
17 1
    };
18
}
19