Code Duplication    Length = 51-57 lines in 4 locations

src/PHPSemVerChecker/Operation/ClassOperationDelta.php 1 location

@@ 8-62 (lines=55) @@
5
use PhpParser\Node\Stmt\Class_;
6
use PHPSemVerChecker\Node\Statement\Class_ as PClass;
7
8
class ClassOperationDelta extends Operation
9
{
10
	/**
11
	 * @var string
12
	 */
13
	protected $fileBefore;
14
	/**
15
	 * @var \PhpParser\Node\Stmt\Class_
16
	 */
17
	protected $classBefore;
18
	/**
19
	 * @var string
20
	 */
21
	protected $fileAfter;
22
	/**
23
	 * @var \PhpParser\Node\Stmt\Class_
24
	 */
25
	protected $classAfter;
26
27
	/**
28
	 * @param string                      $file
29
	 * @param \PhpParser\Node\Stmt\Class_ $class
30
	 */
31
	public function __construct($fileBefore, Class_ $classBefore, $fileAfter, Class_ $classAfter)
32
	{
33
		$this->fileBefore = $fileBefore;
34
		$this->classBefore = $classBefore;
35
		$this->fileAfter = $fileAfter;
36
		$this->classAfter = $classAfter;
37
	}
38
39
	/**
40
	 * @return string
41
	 */
42
	public function getLocation()
43
	{
44
		return $this->fileAfter;
45
	}
46
47
	/**
48
	 * @return int
49
	 */
50
	public function getLine()
51
	{
52
		return $this->classAfter->getLine();
53
	}
54
55
	/**
56
	 * @return string
57
	 */
58
	public function getTarget()
59
	{
60
		return PClass::getFullyQualifiedName($this->classAfter);
61
	}
62
}
63

src/PHPSemVerChecker/Operation/FunctionOperationDelta.php 1 location

@@ 8-64 (lines=57) @@
5
use PhpParser\Node\Stmt\Function_;
6
use PHPSemVerChecker\Node\Statement\Function_ as PFunction;
7
8
abstract class FunctionOperationDelta extends Operation
9
{
10
	/**
11
	 * @var string
12
	 */
13
	protected $fileBefore;
14
	/**
15
	 * @var \PhpParser\Node\Stmt\Function_
16
	 */
17
	protected $functionBefore;
18
	/**
19
	 * @var string
20
	 */
21
	protected $fileAfter;
22
	/**
23
	 * @var \PhpParser\Node\Stmt\Function_
24
	 */
25
	protected $functionAfter;
26
27
	/**
28
	 * @param string                         $fileBefore
29
	 * @param \PhpParser\Node\Stmt\Function_ $functionBefore
30
	 * @param string                         $fileAfter
31
	 * @param \PhpParser\Node\Stmt\Function_ $functionAfter
32
	 */
33
	public function __construct($fileBefore, Function_ $functionBefore, $fileAfter, Function_ $functionAfter)
34
	{
35
		$this->fileBefore = $fileBefore;
36
		$this->functionBefore = $functionBefore;
37
		$this->fileAfter = $fileAfter;
38
		$this->functionAfter = $functionAfter;
39
	}
40
41
	/**
42
	 * @return string
43
	 */
44
	public function getLocation()
45
	{
46
		return $this->fileBefore;
47
	}
48
49
	/**
50
	 * @return int
51
	 */
52
	public function getLine()
53
	{
54
		return $this->functionAfter->getLine();
55
	}
56
57
	/**
58
	 * @return string
59
	 */
60
	public function getTarget()
61
	{
62
		return PFunction::getFullyQualifiedName($this->functionAfter);
63
	}
64
}
65

src/PHPSemVerChecker/Operation/InterfaceOperationDelta.php 1 location

@@ 8-61 (lines=54) @@
5
use PhpParser\Node\Stmt\Interface_;
6
use PHPSemVerChecker\Node\Statement\Interface_ as PInterface;
7
8
class InterfaceOperationDelta extends Operation {
9
	/**
10
	 * @var string
11
	 */
12
	protected $fileBefore;
13
	/**
14
	 * @var \PhpParser\Node\Stmt\Interface_
15
	 */
16
	protected $interfaceBefore;
17
	/**
18
	 * @var string
19
	 */
20
	protected $fileAfter;
21
	/**
22
	 * @var \PhpParser\Node\Stmt\Interface_
23
	 */
24
	protected $interfaceAfter;
25
26
	/**
27
	 * @param string                          $fileAfter
28
	 * @param \PhpParser\Node\Stmt\Interface_ $interface
29
	 */
30
	public function __construct($fileBefore, Interface_ $interfaceBefore, $fileAfter, Interface_ $interfaceAfter)
31
	{
32
		$this->fileBefore = $fileBefore;
33
		$this->interfaceBefore = $interfaceBefore;
34
		$this->fileAfter = $fileAfter;
35
		$this->interfaceAfter = $interfaceAfter;
36
	}
37
38
	/**
39
	 * @return string
40
	 */
41
	public function getLocation()
42
	{
43
		return $this->fileAfter;
44
	}
45
46
	/**
47
	 * @return int
48
	 */
49
	public function getLine()
50
	{
51
		return $this->interfaceAfter->getLine();
52
	}
53
54
	/**
55
	 * @return string
56
	 */
57
	public function getTarget()
58
	{
59
		return PInterface::getFullyQualifiedName($this->interfaceAfter);
60
	}
61
}
62

src/PHPSemVerChecker/Operation/TraitOperationDelta.php 1 location

@@ 8-58 (lines=51) @@
5
use PhpParser\Node\Stmt\Trait_;
6
use PHPSemVerChecker\Node\Statement\Trait_ as PTrait;
7
8
class TraitOperationDelta extends Operation
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
	public function __construct($fileBefore, Trait_ $traitBefore, $fileAfter, Trait_ $traitAfter)
28
	{
29
		$this->fileBefore = $fileBefore;
30
		$this->traitBefore = $traitBefore;
31
		$this->fileAfter = $fileAfter;
32
		$this->traitAfter = $traitAfter;
33
	}
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
	public function getTarget()
55
	{
56
		return PTrait::getFullyQualifiedName($this->traitAfter);
57
	}
58
}
59