Completed
Push — master ( 8f0d0f...15736a )
by Дмитрий
06:53
created

TryCatchSt::compile()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 4.0312

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 7
nc 8
nop 2
dl 0
loc 14
ccs 7
cts 8
cp 0.875
crap 4.0312
rs 9.2
c 1
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
11
class TryCatchSt extends AbstractCompiler
12
{
13
    protected $name = '\PhpParser\Node\Stmt\TryCatch';
14
15
    /**
16
     * @param \PhpParser\Node\Stmt\TryCatch $statement
17
     * @param Context $context
18
     * @return CompiledExpression
19
     */
20 2
    public function compile($statement, Context $context)
21
    {
22 2
        foreach ($statement->stmts as $stmt) {
23 2
            \PHPSA\nodeVisitorFactory($stmt, $context);
24
        }
25
26 2
        foreach ($statement->catches as $stmt) {
27 2
            \PHPSA\nodeVisitorFactory($stmt, $context);
28
        }
29
30 2
        if ($statement->finally !== null) {
31
            \PHPSA\nodeVisitorFactory($statement->finally, $context);
32
        }
33 2
    }
34
}
35