Code Duplication    Length = 10-11 lines in 2 locations

src/Hal/Metric/Class_/Structural/LcomVisitor.php 2 locations

@@ 55-64 (lines=10) @@
52
53
                    \iterate_over_node($stmt, function ($node) use ($from, &$graph) {
54
55
                        if ($node instanceof Node\Expr\PropertyFetch && isset($node->var->name) && $node->var->name == 'this') {
56
                            $name = getNameOfNode($node);
57
                            // use of attribute $this->xxx;
58
                            if (!$graph->has($name)) {
59
                                $graph->insert(new TreeNode($name));
60
                            }
61
                            $to = $graph->get($name);
62
                            $graph->addEdge($from, $to);
63
                            return;
64
                        }
65
66
67
                        if ($node instanceof Node\Expr\MethodCall) {
@@ 68-78 (lines=11) @@
65
66
67
                        if ($node instanceof Node\Expr\MethodCall) {
68
                            if (!$node->var instanceof Node\Expr\New_ && isset($node->var->name) && getNameOfNode($node->var) === 'this') {
69
                                // use of method call $this->xxx();
70
                                // use of attribute $this->xxx;
71
                                $name = getNameOfNode($node->name) . '()';
72
                                if (!$graph->has($name)) {
73
                                    $graph->insert(new TreeNode($name));
74
                                }
75
                                $to = $graph->get($name);
76
                                $graph->addEdge($from, $to);
77
                                return;
78
                            }
79
                        }
80
81
                    });