Passed
Push — trunk ( 9dfcf5...f40966 )
by Christian
12:13 queued 13s
created

ElasticsearchAdminUpdateMappingCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 9
rs 10
c 1
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Elasticsearch\Framework\Command;
4
5
use Shopware\Core\Framework\Log\Package;
6
use Shopware\Elasticsearch\Admin\AdminSearchRegistry;
7
use Symfony\Component\Console\Attribute\AsCommand;
8
use Symfony\Component\Console\Command\Command;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Command\Command was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
use Symfony\Component\Console\Style\SymfonyStyle;
12
13
#[AsCommand(
14
    name: 'es:admin:mapping:update',
15
    description: 'Update the Elasticsearch indices mapping',
16
)]
17
#[Package('core')]
18
class ElasticsearchAdminUpdateMappingCommand extends Command
19
{
20
    /**
21
     * @internal
22
     */
23
    public function __construct(private readonly AdminSearchRegistry $registry)
24
    {
25
        parent::__construct();
26
    }
27
28
    protected function execute(InputInterface $input, OutputInterface $output): int
29
    {
30
        $io = new SymfonyStyle($input, $output);
31
32
        $this->registry->updateMappings();
33
34
        $io->success('Updated mapping for admin indices');
35
36
        return self::SUCCESS;
37
    }
38
}
39