| Conditions | 6 |
| Paths | 8 |
| Total Lines | 30 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 21 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 8 | public function compile($ifStatement, Context $context) |
|
| 22 | { |
||
| 23 | 8 | $context->setCurrentBranch(Variable::BRANCH_CONDITIONAL_TRUE); |
|
| 24 | |||
| 25 | 8 | $context->getExpressionCompiler()->compile($ifStatement->cond); |
|
| 26 | |||
| 27 | 8 | if (count($ifStatement->stmts) > 0) { |
|
| 28 | 5 | foreach ($ifStatement->stmts as $stmt) { |
|
| 29 | 5 | \PHPSA\nodeVisitorFactory($stmt, $context); |
|
| 30 | 5 | } |
|
| 31 | 5 | } else { |
|
| 32 | 3 | $context->notice('not-implemented-body', 'Missing body', $ifStatement); |
|
| 33 | } |
||
| 34 | |||
| 35 | 8 | $context->setCurrentBranch(Variable::BRANCH_CONDITIONAL_EXTERNAL); |
|
| 36 | |||
| 37 | 8 | if (count($ifStatement->elseifs) > 0) { |
|
| 38 | 3 | foreach ($ifStatement->elseifs as $elseIfStatement) { |
|
| 39 | 3 | \PHPSA\nodeVisitorFactory($elseIfStatement, $context); |
|
| 40 | 3 | } |
|
| 41 | 3 | } |
|
| 42 | |||
| 43 | 8 | $context->setCurrentBranch(Variable::BRANCH_CONDITIONAL_FALSE); |
|
| 44 | |||
| 45 | 8 | if ($ifStatement->else) { |
|
| 46 | 2 | \PHPSA\nodeVisitorFactory($ifStatement->else, $context); |
|
| 47 | 2 | } |
|
| 48 | |||
| 49 | 8 | $context->setCurrentBranch(Variable::BRANCH_ROOT); |
|
| 50 | 8 | } |
|
| 51 | } |
||
| 52 |