Completed
Push — master ( 719dbc...a8fbe3 )
by Rémi
03:51
created

HangmanGameLostEvent::deserialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Hangman\Event;
4
5
use Hangman\Event\Util\HangmanBasicResultEvent;
6
use MiniGame\Entity\MiniGameId;
7
use MiniGame\Entity\PlayerId;
8
use MiniGame\Result\AllPlayersResult;
9
use MiniGame\Result\GameLost;
10
11
class HangmanGameLostEvent extends HangmanBasicResultEvent implements AllPlayersResult, GameLost
12
{
13
    /**
14
     * @var string
15
     */
16
    const NAME = 'hangman.lost';
17
18
    /**
19
     * @var string
20
     */
21
    private $word;
22
23
    /**
24
     * Constructor
25
     *
26
     * @param MiniGameId $gameId
27
     * @param PlayerId   $playerId
28
     * @param string     $word
29
     */
30 6
    public function __construct(MiniGameId $gameId, PlayerId $playerId, $word)
31
    {
32 6
        parent::__construct(self::NAME, $gameId, $playerId);
33 6
        $this->word = $word;
34 6
    }
35
36
    /**
37
     * @return string
38
     */
39 3
    public function getWord()
40
    {
41 3
        return $this->word;
42
    }
43
44
    /**
45
     * @return string
46
     */
47 3
    public function getAsMessage()
48
    {
49 3
        return 'Game lost';
50
    }
51
52
    /**
53
     * @return string
54
     */
55 3
    public function getSolution()
56
    {
57 3
        return $this->word;
58
    }
59
}
60