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

NextMapVote::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 13
rs 9.4285
ccs 5
cts 5
cp 1
cc 1
eloc 10
nc 1
nop 6
crap 1
1
<?php
2
3
namespace eXpansion\Bundle\VoteManager\Structures;
4
use eXpansion\Framework\Core\Helpers\ChatNotification;
5
use eXpansion\Framework\Core\Storage\Data\Player;
6
use Maniaplanet\DedicatedServer\Connection;
7
8
/**
9
 * Class NexMapVote
10
 *
11
 * @author    de Cramer Oliver<[email protected]>
12
 * @copyright 2017 Smile
13
 * @package eXpansion\Bundle\VoteManager\Structures
14
 */
15
class NextMapVote extends AbstractVote
16
{
17
    /** @var Connection */
18
    protected $connection;
19
20
    /** @var ChatNotification */
21
    protected $chatNotification;
22
23
    /**
24
     * NexMapVote constructor.
25
     *
26
     * @param Player $player
27
     * @param string $type
28
     * @param int $duration
29
     * @param float $ration
30
     * @param Connection $connection
31
     * @param ChatNotification $chatNotification
32
     */
33 6
    public function __construct(
34
        Player $player,
35
        string $type,
36
        int $duration = 30,
37
        float $ration = 0.57,
38
        Connection $connection,
39
        ChatNotification $chatNotification
40
    ) {
41 6
        parent::__construct($player, $type, $duration, $ration);
42
43 6
        $this->connection = $connection;
44 6
        $this->chatNotification = $chatNotification;
45 6
    }
46
47
48
    /**
49
     * @inheritdoc
50
     */
51 1
    public function getQuestion(): string
52
    {
53 1
        return 'expansion_votemanager.nextmap.question';
54
    }
55
56
    /**
57
     * @inheritdoc
58
     */
59 1
    public function executeVotePassed()
60
    {
61 1
        $this->connection->nextMap(false);
62 1
        $this->chatNotification->sendMessage("|info| Vote passed. Skipping map!");
63 1
    }
64
65
    /**
66
     * @inheritdoc
67
     */
68 1
    public function executeVoteFailed()
69
    {
70
        // Do Nothing
71 1
    }
72
}
73