Completed
Pull Request — master (#233)
by De Cramer
10:00
created

Config::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
dl 11
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 5
1
<?php
2
3
namespace eXpansion\Framework\Config\ChatCommand;
4
5
use eXpansion\Framework\AdminGroups\Helpers\AdminGroups;
6
use eXpansion\Framework\AdminGroups\Model\AbstractAdminChatCommand;
7
use eXpansion\Framework\Config\Ui\Window\ConfigWindowFactory;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Symfony\Component\Console\Input\InputInterface;
10
11
12
/**
13
 * Class Config
14
 *
15
 * @package eXpansion\Framework\Config\ChatCommand;
16
 * @author  oliver de Cramer <[email protected]>
17
 */
18 View Code Duplication
class Config extends AbstractAdminChatCommand
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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