CompareCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
declare(strict_types = 1);
3
namespace T3G\Elasticorn\Commands\Mapping;
4
5
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use T3G\Elasticorn\Commands\BaseCommand;
10
11
/**
12
 * @package T3G\Elasticorn\Commands
13
 */
14
class CompareCommand extends BaseCommand
15
{
16
    /**
17
     * Configure the compare command
18
     *
19
     * @return void
20
     */
21
    protected function configure()
22
    {
23
        parent::configure();
24
        $this
25
            ->setName('mapping:compare')
26
            ->setDescription('compare mapping configuration to applied configuration.');
27
28
        $this->
29
            addArgument('indexName', InputArgument::REQUIRED, 'The index name.');
30
    }
31
32
    /**
33
     * @param InputInterface $input
34
     * @param OutputInterface $output
35
     * @return void
36
     */
37
    protected function execute(InputInterface $input, OutputInterface $output)
38
    {
39
        parent::execute($input, $output);
40
        $this->configurationService->compareMappingConfiguration($input->getArgument('indexName'), $this->indexService->getIndex());
0 ignored issues
show
Bug introduced by
It seems like $input->getArgument('indexName') targeting Symfony\Component\Consol...nterface::getArgument() can also be of type array<integer,string> or null; however, T3G\Elasticorn\Service\C...eMappingConfiguration() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
41
    }
42
43
}