Completed
Pull Request — master (#154)
by De Cramer
02:58
created

RestartMapVote::executeVoteFailed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
ccs 2
cts 2
cp 1
cc 1
eloc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace eXpansion\Bundle\VoteManager\Structures;
4
5
use eXpansion\Bundle\Maps\Services\JukeboxService;
6
use eXpansion\Framework\Core\Helpers\ChatNotification;
7
use eXpansion\Framework\Core\Storage\Data\Player;
8
use eXpansion\Framework\Core\Storage\MapStorage;
9
10
/**
11
 * Class NexMapVote
12
 *
13
 * @author    de Cramer Oliver<[email protected]>
14
 * @copyright 2017 Smile
15
 * @package eXpansion\Bundle\VoteManager\Structures
16
 */
17
class RestartMapVote extends AbstractVote
18
{
19
    /** @var JukeboxService */
20
    protected $jukebox;
21
22
    /** @var MapStorage */
23
    protected $mapStorage;
24
25
    /** @var ChatNotification */
26
    protected $chatNotification;
27
28
    /**
29
     * NexMapVote constructor.
30
     *
31
     * @param Player $player
32
     * @param string $type
33
     * @param int $duration
34
     * @param float $ration
35
     * @param JukeboxService $jukebox
36
     * @param MapStorage $mapStorage
37
     * @param ChatNotification $chatNotification
38
     */
39 3 View Code Duplication
    public function __construct(
0 ignored issues
show
Duplication introduced by
This method 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...
40
        Player $player,
41
        string $type,
42
        int $duration = 30,
43
        float $ration = 0.57,
44
        JukeboxService $jukebox,
45
        MapStorage $mapStorage,
46
        ChatNotification $chatNotification
47
    ) {
48 3
        parent::__construct($player, $type, $duration, $ration);
49
50 3
        $this->jukebox = $jukebox;
51 3
        $this->mapStorage = $mapStorage;
52 3
        $this->chatNotification = $chatNotification;
53 3
    }
54
55
56
    /**
57
     * @inheritdoc
58
     */
59 1
    public function getQuestion(): string
60
    {
61 1
        return 'expansion_votemanager.restartmap.question';
62
    }
63
64
    /**
65
     * @inheritdoc
66
     */
67 1
    public function executeVotePassed()
68
    {
69 1
        $this->jukebox->addMap($this->mapStorage->getCurrentMap(), $this->getPlayer()->getLogin(), true);
70 1
        $this->chatNotification->sendMessage("|info| Vote passed. Will replay map!");
71 1
    }
72
73
    /**
74
     * @inheritdoc
75
     */
76 1
    public function executeVoteFailed()
77
    {
78
        // Do Nothing
79 1
    }
80
}
81