UpgradeEvent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 40
loc 40
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 7 7 1
A getManager() 4 4 1
A getPackage() 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
 * UpgradeEvent.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        https://www.ipublikuj.eu
7
 * @author         Adam Kadlec <[email protected]>
8
 * @package        iPublikuj:Packages!
9
 * @subpackage     Events
10
 * @since          1.0.0
11
 *
12
 * @date           15.11.19
13
 */
14
15
namespace IPub\Packages\Events;
16
17
use Symfony\Contracts\EventDispatcher;
18
19
use IPub\Packages;
20
use IPub\Packages\Entities;
21
22
/**
23
 * Package upgraded event
24
 *
25
 * @package        iPublikuj:Packages!
26
 * @subpackage     Events
27
 *
28
 * @author         Adam Kadlec <[email protected]>
29
 */
30 View Code Duplication
final class UpgradeEvent extends EventDispatcher\Event
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...
31
{
32
	/**
33
	 * @var Packages\PackagesManager
34
	 */
35
	private $manager;
36
37
	/**
38
	 * @var Entities\IPackage
39
	 */
40
	private $package;
41
42
	/**
43
	 * @param Packages\PackagesManager $manager
44
	 * @param Entities\IPackage $package
45
	 */
46
	public function __construct(
47
		Packages\PackagesManager $manager,
48
		Entities\IPackage $package
49
	) {
50
		$this->manager = $manager;
51
		$this->package = $package;
52
	}
53
54
	/**
55
	 * @return Packages\PackagesManager
56
	 */
57
	public function getManager() : Packages\PackagesManager
58
	{
59
		return $this->manager;
60
	}
61
62
	/**
63
	 * @return Entities\IPackage
64
	 */
65
	public function getPackage() : Entities\IPackage
66
	{
67
		return $this->package;
68
	}
69
}
70