VoteStart   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 42
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A execute() 0 5 1
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