HangmanPlayerWinEvent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 48
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getWord() 0 4 1
A getSolution() 0 4 1
1
<?php
2
3
namespace Hangman\Event;
4
5
use Hangman\Event\Util\HangmanResultEvent;
6
use Hangman\Result\HangmanWon;
7
use MiniGame\Entity\MiniGameId;
8
use MiniGame\Entity\PlayerId;
9
use MiniGame\Result\AllPlayersResult;
10
11
class HangmanPlayerWinEvent extends HangmanResultEvent implements AllPlayersResult, HangmanWon
12
{
13
    /**
14
     * @var string
15
     */
16
    const NAME = 'hangman.player.win';
17
18
    /**
19
     * @var string
20
     */
21
    private $word;
22
23
    /**
24
     * Constructor
25
     *
26
     * @param MiniGameId $gameId
27
     * @param PlayerId   $playerId
28
     * @param array      $playedLetters
29
     * @param int        $remainingLives
30
     * @param string     $word
31
     */
32 15
    public function __construct(
33
        MiniGameId $gameId,
34
        PlayerId $playerId,
35
        array $playedLetters,
36
        $remainingLives,
37
        $word
38
    ) {
39 15
        parent::__construct(self::NAME, $gameId, $playerId, $playedLetters, $remainingLives);
40 15
        $this->word = $word;
41 15
    }
42
43
    /**
44
     * @return string
45
     */
46 3
    public function getWord()
47
    {
48 3
        return $this->word;
49
    }
50
51
    /**
52
     * @return string
53
     */
54 6
    public function getSolution()
55
    {
56 6
        return $this->word;
57
    }
58
}
59