Completed
Push — master ( 5f95d7...c6e312 )
by GBProd
02:45
created

ProvideCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 18
ccs 14
cts 14
cp 1
rs 9.4285
cc 1
eloc 13
nc 1
nop 0
crap 1
1
<?php
2
3
namespace GBProd\ElasticsearchDataProviderBundle\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\Output\OutputInterface;
9
10
/**
11
 * Command to run providing
12
 * 
13
 * @author gbprod <[email protected]>
14
 */
15
class ProvideCommand extends ContainerAwareCommand
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 1
    protected function configure()
21
    {
22 1
        $this
23 1
            ->setName('elasticsearch:provide')
24 1
            ->setDescription('Provide data to Elasticsearch')
25 1
            ->addArgument(
26 1
                'index',
27 1
                InputArgument::OPTIONAL,
28
                'Index to provide'
29 1
            )
30 1
            ->addArgument(
31 1
                'type',
32 1
                null,
33 1
                InputArgument::OPTIONAL,
34
                'Type to provide'
35 1
            )
36
        ;
37 1
    }
38
    
39
    /**
40
     * {@inheritdoc}
41
     */
42 1
    protected function execute(InputInterface $input, OutputInterface $output)
43
    {
44 1
        $handler = $this->getContainer()
45 1
            ->get('gbprod.elasticsearch_dataprovider.handler')
46 1
        ;
47
        
48 1
        $handler->handle(
49 1
            $input->getArgument('index'),
50 1
            $input->getArgument('type')
51 1
        );
52 1
    }
53
}
54