Find   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 14
ccs 3
cts 3
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A find() 0 5 2
1
<?php
2
3
namespace Cocur\Chain\Link;
4
5
/**
6
 * Find.
7
 *
8
 * @author    Christoph Rosse
9
 * @copyright 2017 Christoph Rosse
10
 */
11
trait Find
12
{
13
    /**
14
     * Find an element by a comparison callback.
15
     *
16
     * @param callable $callback
17
     *
18
     * @return mixed|bool Found element, `false` if no result is found
19
     */
20 2
    public function find(callable $callback)
21
    {
22 2
        $result = array_filter($this->array, $callback);
23
24 2
        return empty($result) ? false : current($result);
25
    }
26
}
27