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

Remove   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 47
rs 10
c 1
b 0
f 1
ccs 0
cts 30
cp 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getDescription() 0 4 1
A configure() 0 9 1
A execute() 0 5 1
A setMxPlugin() 0 4 1
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