Passed
Push — master ( 958a85...6386e9 )
by Adam
50s queued 10s
created

WarningEvent   A

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 getException() 4 4 1
A getClient() 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
 * WarningEvent.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        https://www.ipublikuj.eu
7
 * @author         Adam Kadlec <[email protected]>
8
 * @package        iPublikuj:MQTTClient!
9
 * @subpackage     Events
10
 * @since          1.0.0
11
 *
12
 * @date           14.11.19
13
 */
14
15
namespace IPub\MQTTClient\Events;
16
17
use Exception;
18
19
use Symfony\Contracts\EventDispatcher;
20
21
use BinSoul\Net\Mqtt;
22
23
use IPub\MQTTClient\Client;
24
25
/**
26
 * Communication warning event
27
 *
28
 * @package        iPublikuj:MQTTClient!
29
 * @subpackage     Events
30
 *
31
 * @author         Adam Kadlec <[email protected]>
32
 */
33 View Code Duplication
final class WarningEvent 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...
34
{
35
	/**
36
	 * @var Exception
37
	 */
38
	private $exception;
39
40
	/**
41
	 * @var Client\IClient
42
	 */
43
	private $client;
44
45
	/**
46
	 * @param Exception $exception
47
	 * @param Client\IClient $client
48
	 */
49
	public function __construct(
50
		Exception $exception,
51
		Client\IClient $client
52
	) {
53
		$this->exception = $exception;
54
		$this->client = $client;
55
	}
56
57
	/**
58
	 * @return Exception
59
	 */
60
	public function getException() : Exception
61
	{
62
		return $this->exception;
63
	}
64
65
	/**
66
	 * @return Client\IClient
67
	 */
68
	public function getClient() : Client\IClient
69
	{
70
		return $this->client;
71
	}
72
}
73