Conditions | 5 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
30 | 5 | public function evaluate(ValueParser $value) |
|
31 | { |
||
32 | 5 | $previousValue = null; |
|
33 | 5 | for ($i = 1; array_key_exists($i, $this->config); $i++) { |
|
34 | 5 | if (empty($this->operators[$i])) { |
|
35 | 5 | $this->assertIsExpression($this->config[$i]); |
|
36 | 5 | $this->operators[$i] = $this->parser->parse($this->config[$i]); |
|
37 | } |
||
38 | |||
39 | 5 | $result = $this->operators[$i]->evaluate($value); |
|
40 | |||
41 | 5 | if ($previousValue !== null && $result !== $previousValue) { |
|
42 | 1 | return true; |
|
43 | } |
||
44 | |||
45 | 5 | $previousValue = $result; |
|
46 | } |
||
47 | |||
48 | 4 | return !$previousValue; |
|
49 | } |
||
50 | } |