Completed
Push — fm-support ( 0de470...22a3ee )
by Konstantinos
04:53
created

WelcomeEvent   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 1
dl 52
loc 52
ccs 4
cts 4
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A getMessage() 4 4 1
A getPlayer() 4 4 1
A notify() 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
 * This file contains a text event
4
 *
5
 * @license    https://github.com/allejo/bzion/blob/master/LICENSE.md GNU General Public License Version 3
6
 */
7
8
namespace BZIon\Event;
9
10
/**
11
 * Event dispatched whenever a new user is created
12
 */
13 View Code Duplication
class WelcomeEvent extends 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...
14
{
15
    /**
16
     * @var string
17
     */
18
    protected $message;
19
20
    /**
21
     * @var \Player
22
     */
23
    protected $player;
24
25
    /**
26
     * Create a new event
27
     *
28
     * @param string  $message The welcome message
29
     * @param \Player $player  The new player
30
     */
31 1
    public function __construct($message, \Player $player)
32
    {
33 1
        $this->message = $message;
34 1
        $this->player  = $player;
35 1
    }
36
37
    /**
38
     * Get the welcome message
39
     *
40
     * @return string
41
     */
42
    public function getMessage()
43
    {
44
        return $this->message;
45
    }
46
47
    /**
48
     * Get the new player
49
     *
50
     * @return \Player
51
     */
52
    public function getPlayer()
53
    {
54
        return $this->player;
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function notify($type)
61
    {
62
        return $this->doNotify($this->player, $type);
63
    }
64
}
65