AbstractCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 28
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 19 2
A validateInput() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Dictionary\Features\PopulateStorage\Populate\Console;
6
7
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...
8
use Symfony\Component\Console\Input\InputInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Input\InputInterface 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\Output\OutputInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Output\OutputInterface 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...
10
use Symfony\Component\Console\Style\SymfonyStyle;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Style\SymfonyStyle 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...
11
use Throwable;
12
13
abstract class AbstractCommand extends Command
14
{
15
    abstract protected function doExecute(InputInterface $input): string;
16
17
    protected function execute(InputInterface $input, OutputInterface $output): int
18
    {
19
        $this->validateInput($input);
20
        $symfonyStyle = new SymfonyStyle($input, $output);
21
        try {
22
            $memory = memory_get_usage();
23
            $start = microtime(true);
24
            $symfonyStyle->info($this->doExecute($input));
25
            $stop = number_format(microtime(true) - $start, 2);
26
27
            $symfonyStyle->success(
28
                sprintf('Process took %f seconds. Memory used %f bytes.', $stop, memory_get_usage() - $memory)
29
            );
30
31
            return Command::SUCCESS;
32
        } catch (Throwable $exception) {
33
            $symfonyStyle->error($exception->getMessage());
34
35
            return Command::FAILURE;
36
        }
37
    }
38
39
    protected function validateInput(InputInterface $input): void
40
    {
41
    }
42
}
43