| Conditions | 5 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 22 | 13 | public function pass($stmt, Context $context) |
|
| 23 | { |
||
| 24 | 13 | $result = false; |
|
| 25 | 13 | $expression = $context->getExpressionCompiler()->compile($stmt->cond); |
|
| 26 | |||
| 27 | 13 | if ($expression->hasValue()) { |
|
| 28 | 13 | $context->notice( |
|
| 29 | 13 | 'fixed_condition', |
|
| 30 | 13 | 'The condition will always result in the same boolean value', |
|
| 31 | $stmt |
||
| 32 | 13 | ); |
|
| 33 | |||
| 34 | 13 | $result = true; |
|
| 35 | 13 | } |
|
| 36 | |||
| 37 | 13 | if ($stmt instanceof If_) { |
|
| 38 | 8 | foreach ($stmt->elseifs as $elseif) { |
|
| 39 | 3 | $result = $this->pass($elseif, $context) || $result; |
|
| 40 | 8 | } |
|
| 41 | 8 | } |
|
| 42 | |||
| 43 | 13 | return $result; |
|
| 44 | } |
||
| 45 | |||
| 59 |