Code Duplication    Length = 13-19 lines in 2 locations

src/ElasticaExtraBundle/Command/ListAliasCommand.php 1 location

@@ 33-51 (lines=19) @@
30
    /**
31
     * {@inheritdoc}
32
     */
33
    protected function execute(InputInterface $input, OutputInterface $output)
34
    {
35
        $client = $this->getClient($input->getOption('client'));
36
        $index  = $input->getArgument('index');
37
38
        $output->writeln(sprintf(
39
            '<info>Aliases for index <comment>%s</comment></info>',
40
            $index
41
        ));
42
43
        $aliases = $client
44
            ->getIndex($index)
45
            ->getAliases()
46
        ;
47
48
        foreach ($aliases as $alias) {
49
            $output->writeln(' * '.$alias);
50
        }
51
    }
52
}
53

src/ElasticaExtraBundle/Command/ListIndexCommand.php 1 location

@@ 33-45 (lines=13) @@
30
    /**
31
     * {@inheritdoc}
32
     */
33
    protected function execute(InputInterface $input, OutputInterface $output)
34
    {
35
        $client = $this->getClient($input->getOption('client'));
36
37
        $uri = sprintf('_cat/indices/%s?h=i', $input->getOption('pattern'));
38
        $response = $client->request($uri);
39
40
        $indices = $this->extractIndices($response->getData()['message']);
41
42
        foreach ($indices as $index) {
43
            $output->writeln($index);
44
        }
45
    }
46
47
    private function extractIndices($data)
48
    {