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

FunctionAdded   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 7
Bugs 0 Features 2
Metric Value
wmc 4
c 7
b 0
f 2
lcom 1
cbo 3
dl 0
loc 52
ccs 6
cts 6
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getTarget() 0 4 1
A getLocation() 0 4 1
A getLine() 0 4 1
1
<?php
2
3
namespace PHPSemVerChecker\Operation;
4
5
use PhpParser\Node\Stmt\Function_;
6
use PHPSemVerChecker\Node\Statement\Function_ as PFunction;
7
8
class FunctionAdded extends Operation {
9
	/**
10
	 * @var string
11
	 */
12
	protected $code = 'V003';
13
	/**
14
	 * @var string
15
	 */
16
	protected $reason = 'Function has been added.';
17
	/**
18
	 * @var string
19
	 */
20
	protected $fileAfter;
21
	/**
22
	 * @var \PhpParser\Node\Stmt\Function_
23
	 */
24
	protected $functionAfter;
25
26
	/**
27
	 * @param string                         $fileAfter
28
	 * @param \PhpParser\Node\Stmt\Function_ $functionAfter
29
	 */
30 1
	public function __construct($fileAfter, Function_ $functionAfter)
31
	{
32 1
		$this->fileAfter = $fileAfter;
33 1
		$this->functionAfter = $functionAfter;
34 1
	}
35
36
	/**
37
	 * @return string
38
	 */
39
	public function getLocation()
40
	{
41
		return $this->fileAfter;
42
	}
43
44
	/**
45
	 * @return int
46
	 */
47
	public function getLine()
48
	{
49
		return $this->functionAfter->getLine();
50
	}
51
52
	/**
53
	 * @return string
54
	 */
55 1
	public function getTarget()
56
	{
57 1
		return PFunction::getFullyQualifiedName($this->functionAfter);
58
	}
59
}
60