Completed
Push — master ( 206125...47c10a )
by De Cramer
13s
created

RestartMap::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 13
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 13
loc 13
rs 9.4285
ccs 6
cts 6
cp 1
cc 1
eloc 10
nc 1
nop 5
crap 1
1
<?php
2
3
namespace eXpansion\Bundle\VoteManager\Services\VoteFactories;
4
5
use eXpansion\Bundle\Maps\Services\JukeboxService;
6
use eXpansion\Bundle\VoteManager\Structures\AbstractVote;
7
use eXpansion\Bundle\VoteManager\Structures\RestartMapVote;
8
use eXpansion\Framework\Core\Helpers\ChatNotification;
9
use eXpansion\Framework\Core\Storage\Data\Player;
10
use eXpansion\Framework\Core\Storage\MapStorage;
11
12
/**
13
 * Class RestartMap
14
 *
15
 * @author    de Cramer Oliver<[email protected]>
16
 * @copyright 2017 Smile
17
 * @package eXpansion\Bundle\VoteManager\Services\VoteFactories
18
 */
19
class RestartMap extends AbstractFactory
20
{
21
    /** @var JukeboxService */
22
    protected $jukebox;
23
24
    /** @var MapStorage */
25
    protected $mapStorage;
26
27
    /** @var ChatNotification */
28
    protected $chatNotification;
29
30 2 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...
31
        int $duration,
32
        float $ration,
33
        JukeboxService $jukebox,
34
        MapStorage $mapStorage,
35
        ChatNotification $chatNotification
36
    ) {
37 2
        parent::__construct($duration, $ration);
38
39 2
        $this->jukebox = $jukebox;
40 2
        $this->mapStorage = $mapStorage;
41 2
        $this->chatNotification = $chatNotification;
42 2
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47 1
    public function create(Player $player): AbstractVote
48
    {
49 1
        return new RestartMapVote(
50 1
            $player,
51 1
            $this->getVoteCode(),
52 1
            $this->duration,
53 1
            $this->ration,
54 1
            $this->jukebox,
55 1
            $this->mapStorage,
56 1
            $this->chatNotification
57
        );
58
    }
59
60
    /**
61
     * @inheritdoc
62
     */
63 2
    public function getVoteCode(): string
64
    {
65 2
        return 'Exp_RestartMap';
66
    }
67
68
    /**
69
     * @inheritdoc
70
     */
71 1
    public function getReplacementTypes()
72
    {
73 1
        return ['RestartMap'];
74
    }
75
}