Test Failed
Push — main ( 6d127d...41f629 )
by mikhail
13:20
created

AnalyzeCommentCommand::parseConfigFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SavinMikhail\CommentsDensity\Commands;
6
7
use SavinMikhail\CommentsDensity\Reporters\ReporterFactory;
0 ignored issues
show
Bug introduced by
The type SavinMikhail\CommentsDen...porters\ReporterFactory 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;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class AnalyzeCommentCommand extends Command
12
{
13
    protected function configure(): void
14
    {
15
        $this->setName('analyze:comments')
16
            ->setDescription('Analyzes the comment density in files within a directory.')
17
            ->setHelp('This command allows you to analyze the comments in PHP files within a specified directory.');
18
    }
19
20
    /**
21
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
22
     */
23
    protected function execute(InputInterface $input, OutputInterface $output): int
24
    {
25
        $configDto = $this->getConfigDto();
26
27 2
        $files = $this->getFilesFromDirectories($this->getDirectories($configDto));
28
        $reporter = (new ReporterFactory())->createReporter($output, $configDto);
29 2
30 2
        $analyzer = $this->getAnalyzer($configDto, $output, $reporter);
31 2
32
        return $this->analyze($analyzer, $files, $output);
33
    }
34
}
35