Completed
Pull Request — master (#229)
by Enrico
04:42
created

ForSt   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
B compile() 0 18 5
1
<?php
2
/**
3
 * @author Patsura Dmitry https://github.com/ovr <[email protected]>
4
 */
5
6
namespace PHPSA\Compiler\Statement;
7
8
use PHPSA\CompiledExpression;
9
use PHPSA\Context;
10
11
class ForSt extends AbstractCompiler
12
{
13
    protected $name = '\PhpParser\Node\Stmt\For_';
14
15
    /**
16
     * @param \PhpParser\Node\Stmt\For_ $stmt
17
     * @param Context $context
18
     * @return CompiledExpression
19
     */
20 6
    public function compile($stmt, Context $context)
21
    {
22 6
        foreach ($stmt->init as $init) {
23 2
            $context->getExpressionCompiler()->compile($init);
24 6
        }
25
26 6
        foreach ($stmt->cond as $cond) {
27 3
            $context->getExpressionCompiler()->compile($cond);
28 6
        }
29
30 6
        foreach ($stmt->loop as $loop) {
31 2
            $context->getExpressionCompiler()->compile($loop);
32 6
        }
33
34 6
        foreach ($stmt->stmts as $statement) {
35 3
            \PHPSA\nodeVisitorFactory($statement, $context);
36 6
        }
37 6
    }
38
}
39