Completed
Pull Request — master (#104)
by
unknown
03:28
created

Remove::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 5
rs 9.4285
c 1
b 0
f 1
ccs 0
cts 5
cp 0
cc 1
eloc 3
nc 1
nop 2
crap 2
1
<?php
2
3
namespace eXpansion\Bundle\Maps\ChatCommand;
4
5
use eXpansion\Bundle\AdminChat\ChatCommand\AbstractConnectionCommand;
6
use eXpansion\Bundle\Maps\Plugins\ManiaExchange;
7
use eXpansion\Bundle\Maps\Plugins\Maps;
8
use eXpansion\Bundle\Maps\Services\JukeboxService;
9
use eXpansion\Framework\AdminGroups\Helpers\AdminGroups;
10
use Symfony\Component\Console\Input\InputArgument;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Tests\eXpansion\Framework\AdminGroups\TestHelpers\AdminChatCommand;
13
14
/**
15
 *
16
 * @author  Reaby
17
 *
18
 */
19
class Remove extends AdminChatCommand
20
{
21
22
    /** @var  Maps */
23
    protected $plugin;
24
25
    public function __construct(
26
        $command,
27
        $permission,
28
        $aliases = [],
29
        AdminGroups $adminGroupsHelper,
30
        Maps $plugin
31
    ) {
32
        parent::__construct($command, $permission, $aliases, $adminGroupsHelper);
33
        $this->plugin = $plugin;
34
    }
35
36
37
    public function getDescription()
38
    {
39
        return 'expansion_mx.command.remove.description';
40
    }
41
42
    protected function configure()
43
    {
44
        parent::configure();
45
46
        $this->inputDefinition->addArgument(
47
            new InputArgument('index', InputArgument::REQUIRED, 'expansion_mx.command.remove.index')
48
        );
49
50
    }
51
52
    /**
53
     * @inheritdoc
54
     */
55
    public function execute($login, InputInterface $input)
56
    {
57
        $index = $input->getArgument('index');
58
        $this->plugin->removeMap($login, $index);
59
    }
60
61
    public function setMxPlugin(ManiaExchange $plugin)
62
    {
63
        $this->plugin = $plugin;
0 ignored issues
show
Documentation Bug introduced by
It seems like $plugin of type object<eXpansion\Bundle\...\Plugins\ManiaExchange> is incompatible with the declared type object<eXpansion\Bundle\Maps\Plugins\Maps> of property $plugin.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
64
    }
65
}
66
67
68