Completed
Push — master ( a86091...f009d3 )
by GBProd
02:31
created

PutIndexMappingsCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 12

Duplication

Lines 17
Ratio 100 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 17
loc 17
ccs 12
cts 12
cp 1
rs 9.4285
cc 1
eloc 12
nc 1
nop 0
crap 1
1
<?php
2
3
namespace GBProd\ElasticsearchExtraBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Input\InputOption;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
/**
12
 * Command to put index mappings
13
 * 
14
 * @author gbprod <[email protected]>
15
 */
16 View Code Duplication
class PutIndexMappingsCommand extends ContainerAwareCommand
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...
17
{
18
    protected function configure()
19
    {
20 1
        $this
21 1
            ->setName('elasticsearch:index:put_mappings')
22 1
            ->setDescription('Put index mappings from configuration')
23 1
            ->addArgument(
24 1
                'client_id',
25 1
                InputArgument::REQUIRED,
26
                'Which client ?'
27 1
            )
28 1
            ->addArgument(
29 1
                'index_id',
30 1
                InputArgument::REQUIRED,
31
                'Which index ?'
32 1
            )
33
        ;
34 1
    }
35
36
    protected function execute(InputInterface $input, OutputInterface $output)
37 1
    {
38 1
        $clientId = $input->getArgument('client_id');
39 1
        $indexId  = $input->getArgument('index_id');
40
        
41 1
        $output->writeln(sprintf(
42 1
            '<info>Put index <comment>%s</comment> settings for client <comment>%s</comment>...</info>',
43 1
            $indexId,
44
            $clientId
45 1
        ));
46
        
47 1
        $handler = $this
48 1
            ->getContainer()
49 1
            ->get('gbprod.elasticsearch_extra.put_index_mappings_handler')
50 1
        ;
51
        
52 1
        $handler->handle($clientId, $indexId);
53
        
54 1
        $output->writeln('done');
55 1
    }
56
}
57