Catch_   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubNodeNames() 3 3 1
A __construct() 6 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace PhpParser\Node\Stmt;
4
5
use PhpParser\Node;
6
7 View Code Duplication
class Catch_ extends Node\Stmt
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    /** @var Node\Name Class of exception */
10
    public $type;
11
    /** @var string Variable for exception */
12
    public $var;
13
    /** @var Node[] Statements */
14
    public $stmts;
15
16
    /**
17
     * Constructs a catch node.
18
     *
19
     * @param Node\Name $type       Class of exception
20
     * @param string    $var        Variable for exception
21
     * @param Node[]    $stmts      Statements
22
     * @param array     $attributes Additional attributes
23
     */
24
    public function __construct(Node\Name $type, $var, array $stmts = array(), array $attributes = array()) {
25
        parent::__construct($attributes);
26
        $this->type = $type;
27
        $this->var = $var;
28
        $this->stmts = $stmts;
29
    }
30
31
    public function getSubNodeNames() {
32
        return array('type', 'var', 'stmts');
33
    }
34
}
35