Test Failed
Push — master ( 85ca69...144c12 )
by Roman
15:41
created

AbstractCommand::validateInput()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 2
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Crossword\UI\Console;
6
7
use App\Crossword\Application\Response\Console\ConsoleResponse;
8
use App\Crossword\Application\Response\Console\ResponseInterface;
9
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...
10
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...
11
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...
12
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...
13
use Throwable;
14
15
abstract class AbstractCommand extends Command
16
{
17
    abstract protected function doExecute(InputInterface $input, ResponseInterface $response): void;
18
19
    protected function execute(InputInterface $input, OutputInterface $output): int
20
    {
21
        $this->validateInput($input);
22
        $symfonyStyle = new SymfonyStyle($input, $output);
23
        try {
24
            $memory = memory_get_usage();
25
            $start = microtime(true);
26
            $this->doExecute($input, new ConsoleResponse($input, $output));
27
            $stop = number_format(microtime(true) - $start, 2);
28
29
            $symfonyStyle->success(
30
                sprintf('Process took %f seconds. Memory used %f bytes.', $stop, memory_get_usage() - $memory)
31
            );
32
33
            return Command::SUCCESS;
34
        } catch (Throwable $exception) {
35
            $symfonyStyle->error($exception->getMessage());
36
37
            return Command::FAILURE;
38
        }
39
    }
40
41
    protected function validateInput(InputInterface $input): void
42
    {
43
    }
44
}
45