Completed
Pull Request — master (#229)
by Enrico
06:28
created

CatchSt::compile()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 8
ccs 6
cts 6
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
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
use PHPSA\Variable;
11
12
class CatchSt extends AbstractCompiler
13
{
14
    protected $name = '\PhpParser\Node\Stmt\Catch_';
15
16
    /**
17
     * @param \PhpParser\Node\Stmt\Catch_ $statement
18
     * @param Context $context
19
     */
20 2
    public function compile($statement, Context $context)
21
    {
22 2
        $context->addVariable(new Variable($statement->var, null, CompiledExpression::OBJECT));
23
24 2
        foreach ($statement->stmts as $stmt) {
25 2
            \PHPSA\nodeVisitorFactory($stmt, $context);
26 2
        }
27 2
    }
28
}
29