Passed
Pull Request — master (#51)
by Nicolas
01:55
created

Every   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A every() 0 8 3
1
<?php
2
3
namespace Cocur\Chain\Link;
4
5
/**
6
 * Every.
7
 *
8
 * @author    Nicolas Reynis
9
 */
10
trait Every
11
{
12
    /**
13
     * @param callable $callback
14
     *
15
     * @return bool
16
     */
17 5
    public function every(callable $callback): bool
18
    {
19 5
        $pass = true;
20 5
        foreach ($this->array as $index => $element) {
21 4
            $pass = $pass && $callback($element, $index);
22
        }
23
24 5
        return $pass;
25
    }
26
}
27