CompareCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 2
cbo 4
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 10 1
A execute() 0 5 1
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
}