Completed
Push — master ( fc895f...00e4a7 )
by Kenji
03:57 queued 01:31
created

NodeVisitor   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 13
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 13
loc 13
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
B leaveNode() 10 10 8

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
 * Part of ci-phpunit-test
4
 *
5
 * @author     Kenji Suzuki <https://github.com/kenjis>
6
 * @license    MIT License
7
 * @copyright  2015 Kenji Suzuki
8
 * @link       https://github.com/kenjis/ci-phpunit-test
9
 */
10
11
namespace Kenjis\MonkeyPatch\Patcher\MethodPatcher;
12
13
use PhpParser\Node;
14
use PhpParser\Node\Stmt\ClassMethod;
15
use PhpParser\NodeVisitorAbstract;
16
17
use Kenjis\MonkeyPatch\Patcher\MethodPatcher;
18
19 View Code Duplication
class NodeVisitor extends NodeVisitorAbstract
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...
20
{
21
	public function leaveNode(Node $node)
22
	{
23
		if (! ($node instanceof ClassMethod))
24
		{
25
			return;
26
		}
27
28
		$pos = $node->getAttribute('startTokenPos');
29
		MethodPatcher::$replacement[$pos] = true;
30
	}
31
}
32