Completed
Push — master ( 1cdbe4...17a825 )
by T
02:03
created

TraitOperationDelta   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 51
loc 51
ccs 8
cts 12
cp 0.6667
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 7 7 1
A getLocation() 4 4 1
A getLine() 4 4 1
A getTarget() 4 4 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 PHPSemVerChecker\Operation;
4
5
use PhpParser\Node\Stmt\Trait_;
6
use PHPSemVerChecker\Node\Statement\Trait_ as PTrait;
7
8 View Code Duplication
class TraitOperationDelta extends Operation
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...
9
{
10
	/**
11
	 * @var string
12
	 */
13
	protected $fileBefore;
14
	/**
15
	 * @var \PhpParser\Node\Stmt\Trait_
16
	 */
17
	protected $traitBefore;
18
	/**
19
	 * @var string
20
	 */
21
	protected $fileAfter;
22
	/**
23
	 * @var \PhpParser\Node\Stmt\Trait_
24
	 */
25
	protected $traitAfter;
26
27 1
	public function __construct($fileBefore, Trait_ $traitBefore, $fileAfter, Trait_ $traitAfter)
28
	{
29 1
		$this->fileBefore = $fileBefore;
30 1
		$this->traitBefore = $traitBefore;
31 1
		$this->fileAfter = $fileAfter;
32 1
		$this->traitAfter = $traitAfter;
33 1
	}
34
35
	/**
36
	 * @return string
37
	 */
38
	public function getLocation()
39
	{
40
		return $this->fileAfter;
41
	}
42
43
	/**
44
	 * @return int
45
	 */
46
	public function getLine()
47
	{
48
		return $this->traitAfter->getLine();
49
	}
50
51
	/**
52
	 * @return string
53
	 */
54 1
	public function getTarget()
55
	{
56 1
		return PTrait::getFullyQualifiedName($this->traitAfter);
57
	}
58
}
59