VoteStart::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace eXpansion\Bundle\VoteManager\ChatCommand;
4
5
use eXpansion\Bundle\VoteManager\Plugins\VoteManager;
6
use eXpansion\Bundle\VoteManager\Services\VoteService;
7
use eXpansion\Framework\Core\Model\ChatCommand\AbstractChatCommand;
8
use eXpansion\Framework\Core\Storage\PlayerStorage;
9
use Symfony\Component\Console\Input\InputInterface;
10
11
/**
12
 * Class Records
13
 *
14
 * @package eXpansion\Bundle\LocalRecords\ChatCommand;
15
 * @author  reaby
16
 */
17
class VoteStart extends AbstractChatCommand
18
{
19
    /** @var VoteService */
20
    private $voteService;
21
22
    /** @var PlayerStorage */
23
    private $playerStorage;
24
25
    /** @var string */
26
    protected $voteTypeCode;
27
28
    /**
29
     * VoteStart constructor.
30
     *
31
     * @param $command
32
     * @param array $aliases
33
     * @param VoteService $voteService
34
     * @param PlayerStorage $playerStorage
35
     * @param $voteTypeCode
36
     */
37
    public function __construct(
38
        $command,
39
        array $aliases = [],
40
        VoteService $voteService,
41
        PlayerStorage $playerStorage,
42
        $voteTypeCode
43
    ) {
44
        parent::__construct($command, $aliases);
45
        $this->voteService = $voteService;
46
        $this->playerStorage = $playerStorage;
47
        $this->voteTypeCode = $voteTypeCode;
48
    }
49
50
    /**
51
     * @inheritdoc
52
     */
53
    public function execute($login, InputInterface $input)
54
    {
55
        $player = $this->playerStorage->getPlayerInfo($login);
56
        $this->voteService->startVote($player, $this->voteTypeCode, []);
57
    }
58
}
59