Passed
Pull Request — master (#5)
by Nicolas
01:43 queued 21s
created

Every   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 15
ccs 0
cts 5
cp 0
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
    public function every(callable $callback): bool
18
    {
19
        $pass = true;
20
        foreach ($this->array as $index => $element) {
21
            $pass = $pass && $callback($element, $index);
22
        }
23
24
        return $pass;
25
    }
26
}
27