Passed
Push — master ( 3d9956...5152d0 )
by Florian
02:21 queued 11s
created

Some::some()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 4
c 1
b 0
f 1
nc 3
nop 1
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 3
rs 10
1
<?php
2
3
namespace Cocur\Chain\Link;
4
5
/**
6
 * Some.
7
 *
8
 * @author    Nicolas Reynis
9
 */
10
trait Some
11
{
12
    /**
13
     * @param callable $callback
14
     *
15
     * @return bool
16
     */
17 5
    public function some(callable $callback): bool
18
    {
19 5
        foreach ($this->array as $index => $element) {
20 4
            if ($callback($element, $index)) {
21 3
                return true;
22
            }
23
        }
24
25 2
        return false;
26
    }
27
}
28