Completed
Pull Request — master (#82)
by Graham
15:21 queued 09:41
created

FunctionParameterChanged::getLine()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 4
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace PHPSemVerChecker\Operation;
4
5
use PhpParser\Node\Stmt\Function_;
6
use PHPSemVerChecker\Node\Statement\Function_ as PFunction;
7
8 View Code Duplication
class FunctionParameterChanged 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
	 * @var string
11
	 */
12
	protected $code = 'V002';
13
	/**
14
	 * @var string
15
	 */
16
	protected $reason = 'Function parameter changed.';
17
	/**
18
	 * @var string
19
	 */
20
	protected $fileBefore;
21
	/**
22
	 * @var \PhpParser\Node\Stmt\Function_
23
	 */
24
	protected $functionBefore;
25
	/**
26
	 * @var string
27
	 */
28
	protected $fileAfter;
29
	/**
30
	 * @var \PhpParser\Node\Stmt\Function_
31
	 */
32
	protected $functionAfter;
33
34
	/**
35
	 * @param string                         $fileBefore
36
	 * @param \PhpParser\Node\Stmt\Function_ $functionBefore
37
	 * @param string                         $fileAfter
38
	 * @param \PhpParser\Node\Stmt\Function_ $functionAfter
39
	 */
40 2
	public function __construct($fileBefore, Function_ $functionBefore, $fileAfter, Function_ $functionAfter)
41
	{
42 2
		$this->fileBefore = $fileBefore;
43 2
		$this->functionBefore = $functionBefore;
44 2
		$this->fileAfter = $fileAfter;
45 2
		$this->functionAfter = $functionAfter;
46 2
	}
47
48
	/**
49
	 * @return string
50
	 */
51
	public function getLocation()
52
	{
53
		return $this->fileBefore;
54
	}
55
56
	/**
57
	 * @return int
58
	 */
59
	public function getLine()
60
	{
61
		return $this->functionAfter->getLine();
62
	}
63
64
	/**
65
	 * @return string
66
	 */
67 2
	public function getTarget()
68
	{
69 2
		return PFunction::getFullyQualifiedName($this->functionAfter);
70
	}
71
}
72