Passed
Push — master ( 3f4370...54e8a7 )
by Sérgio
03:37
created

any.php ➔ any()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 1
nop 1
dl 8
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 any = __NAMESPACE__.'\any';
8
9
use Closure;
10
11 View Code Duplication
function any(callable $pred): Closure
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    return function (array $xs) use ($pred): bool {
14
        return array_reduce($xs, function (bool $prev, $x) use ($pred): bool {
15 2
            return $prev ?: $pred($x);
16 2
        }, false);
17 2
    };
18
}
19