TryCatch   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubNodeNames() 0 3 1
A __construct() 0 10 3
1
<?php
2
3
namespace PhpParser\Node\Stmt;
4
5
use PhpParser\Node;
6
use PhpParser\Error;
7
8
class TryCatch extends Node\Stmt
9
{
10
    /** @var Node[] Statements */
11
    public $stmts;
12
    /** @var Catch_[] Catches */
13
    public $catches;
14
    /** @var null|Node[] Finally statements */
15
    public $finallyStmts;
16
17
    /**
18
     * Constructs a try catch node.
19
     *
20
     * @param Node[]      $stmts        Statements
21
     * @param Catch_[]    $catches      Catches
22
     * @param null|Node[] $finallyStmts Finally statements (null means no finally clause)
23
     * @param array|null  $attributes   Additional attributes
24
     */
25
    public function __construct(array $stmts, array $catches, array $finallyStmts = null, array $attributes = array()) {
26
        if (empty($catches) && null === $finallyStmts) {
27
            throw new Error('Cannot use try without catch or finally');
28
        }
29
30
        parent::__construct($attributes);
31
        $this->stmts = $stmts;
32
        $this->catches = $catches;
33
        $this->finallyStmts = $finallyStmts;
34
    }
35
36
    public function getSubNodeNames() {
37
        return array('stmts', 'catches', 'finallyStmts');
38
    }
39
}
40