Completed
Push — master ( df9952...f86661 )
by Hannes
04:17 queued 02:11
created

ListAll::evaluate()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 14
Code Lines 7

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.2
c 0
b 0
f 0
cc 4
eloc 7
nc 4
nop 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace hanneskod\yaysondb\Expression\Set;
6
7
use hanneskod\yaysondb\Expression\Set;
8
9
/**
10
 * Expression must evaluate to true for each list item
11
 */
12 View Code Duplication
class ListAll extends Set
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /**
15
     * Expression must evaluate to true for each list item
16
     */
17
    public function evaluate($list): bool
18
    {
19
        if (!is_array($list)) {
20
            return false;
21
        }
22
23
        foreach ($list as $item) {
24
            if (!$this->expr->evaluate($item)) {
25
                return false;
26
            }
27
        }
28
29
        return true;
30
    }
31
}
32