AnyTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A test() 0 14 1
1
<?php
2
3
namespace Prelude\Tests;
4
5
use function Prelude\any;
6
7
class AnyTest extends \PHPUnit\Framework\TestCase
8
{
9
    public function test()
10
    {
11
        $isEven = function ($n) { return $n % 2 === 0; };
12
        $isOdd = function ($n) { return $n % 2 === 1; };
13
14
        $this->assertTrue(any($isEven)([1, 3, 4, 5, 7]));
15
        $this->assertFalse(any($isEven)([1, 3, 5, 7]));
16
17
        $this->assertTrue(any($isOdd)([1, 3, 5, 7]));
18
        $this->assertFalse(any($isOdd)([2, 4, 6]));
19
20
        $this->assertTrue(any('is_array')([2, []]));
21
        $this->assertFalse(any('is_array')(['s', 'x']));
22
    }
23
}
24