Code Duplication    Length = 43-48 lines in 3 locations

src/eXpansion/Bundle/Maps/ChatCommand/Jukebox.php 1 location

@@ 20-67 (lines=48) @@
17
 * @package eXpansion\Bundle\LocalRecords\ChatCommand;
18
 * @author  reaby
19
 */
20
class Jukebox extends AbstractChatCommand
21
{
22
    /** @var JukeboxPlugin */
23
    protected $jukeboxPlugin;
24
25
    /**
26
     * @inheritdoc
27
     */
28
    protected function configure()
29
    {
30
        parent::configure();
31
32
        $this->inputDefinition->addArgument(
33
            new InputArgument('action', InputArgument::REQUIRED, 'expansion_jukebox.chat.command.jukebox.description')
34
        );
35
    }
36
37
    public function getHelp()
38
    {
39
        return 'expansion_jukebox.chat.command.jukebox.help';
40
    }
41
42
    /**
43
     * MapsList constructor.
44
     *
45
     * @param $command
46
     * @param array $aliases
47
     * @param JukeboxPlugin $jukeboxPlugin
48
     */
49
    public function __construct(
50
        $command,
51
        array $aliases = [],
52
        JukeboxPlugin $jukeboxPlugin
53
    ) {
54
        parent::__construct($command, $aliases);
55
56
        $this->jukeboxPlugin = $jukeboxPlugin;
57
    }
58
59
    /**
60
     * @inheritdoc
61
     */
62
    public function execute($login, InputInterface $input)
63
    {
64
        $action = $input->getArgument('action');
65
        $this->jukeboxPlugin->jukeboxCommand($login, $action);
66
    }
67
}
68

src/eXpansion/Bundle/Maps/ChatCommand/Remove.php 1 location

@@ 17-59 (lines=43) @@
14
 * @author  Reaby
15
 *
16
 */
17
class Remove extends AbstractAdminChatCommand
18
{
19
20
    /** @var  Maps */
21
    protected $plugin;
22
23
    public function __construct(
24
        $command,
25
        $permission,
26
        $aliases = [],
27
        AdminGroups $adminGroupsHelper,
28
        Maps $plugin
29
    ) {
30
        parent::__construct($command, $permission, $aliases, $adminGroupsHelper);
31
        $this->plugin = $plugin;
32
    }
33
34
35
    public function getDescription()
36
    {
37
        return 'expansion_mx.command.remove.description';
38
    }
39
40
    protected function configure()
41
    {
42
        parent::configure();
43
44
        $this->inputDefinition->addArgument(
45
            new InputArgument('index', InputArgument::REQUIRED, 'expansion_mx.command.remove.index')
46
        );
47
48
    }
49
50
    /**
51
     * @inheritdoc
52
     */
53
    public function execute($login, InputInterface $input)
54
    {
55
        $index = $input->getArgument('index');
56
        $this->plugin->removeMap($login, $index);
57
    }
58
59
}
60
61
62

src/eXpansion/Framework/Config/ChatCommand/Config.php 1 location

@@ 18-65 (lines=48) @@
15
 * @package eXpansion\Framework\Config\ChatCommand;
16
 * @author  oliver de Cramer <[email protected]>
17
 */
18
class Config extends AbstractAdminChatCommand
19
{
20
    /** @var ConfigWindowFactory */
21
    protected $configWindow;
22
23
    /**
24
     * Config constructor.
25
     *
26
     * @param                     $command
27
     * @param string              $permission
28
     * @param array               $aliases
29
     * @param AdminGroups         $adminGroups
30
     * @param ConfigWindowFactory $configWindow
31
     */
32
    public function __construct(
33
        $command,
34
        string $permission,
35
        $aliases = [],
36
        AdminGroups $adminGroups,
37
        ConfigWindowFactory $configWindow
38
39
    ) {
40
        parent::__construct($command, $permission, $aliases, $adminGroups);
41
        $this->configWindow = $configWindow;
42
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47
    protected function configure()
48
    {
49
        parent::configure();
50
51
        $this->inputDefinition->addArgument(
52
            new InputArgument('path', InputArgument::REQUIRED, 'Path to the configs.')
53
        );
54
    }
55
56
57
    /**
58
     * @inheritdoc
59
     */
60
    public function execute($login, InputInterface $input)
61
    {
62
        $this->configWindow->setCurrentPath($input->getArgument('path'));
63
        $this->configWindow->create($login);
64
    }
65
}
66