RemoveCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
/**
3
 * CRM library
4
 * @author Tao <[email protected]>
5
 */
6
namespace Slince\Crm\Command;
7
8
use Slince\Crm\ConfigPath;
9
use Symfony\Component\Console\Input\InputArgument;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
class RemoveCommand extends Command
14
{
15
    /**
16
     * Command name
17
     * @var string
18
     */
19
    const NAME = 'remove';
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function configure()
25
    {
26
        $this->setName(static::NAME)
27
            ->setDescription('Delete one custom registry')
28
            ->addArgument('registry-name', InputArgument::REQUIRED, 'The registry name you want remove');
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function execute(InputInterface $input, OutputInterface $output)
35
    {
36
        $registryName = $input->getArgument('registry-name');
37
        //Remove registry & dump to config file
38
        $this->getManager()->removeRegistry($registryName);
39
        $this->getManager()->dumpRepositoriesToFile(ConfigPath::getUserConfigFile());
40
41
        $output->writeln("<info>Remove registry [{$registryName}] success</info>");
42
    }
43
}
44