Passed
Push — main ( b8dd52...35d689 )
by mikhail
03:26
created

Command::getAnalyzer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 4
dl 0
loc 7
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SavinMikhail\CommentsDensity\Commands;
6
7
use Generator;
8
use RecursiveDirectoryIterator;
9
use RecursiveIteratorIterator;
10
use SavinMikhail\CommentsDensity\AnalyzerFactory;
0 ignored issues
show
Bug introduced by
The type SavinMikhail\CommentsDensity\AnalyzerFactory 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 SavinMikhail\CommentsDensity\CommentDensity;
12
use SavinMikhail\CommentsDensity\ConfigLoader;
0 ignored issues
show
Bug introduced by
The type SavinMikhail\CommentsDensity\ConfigLoader 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 SavinMikhail\CommentsDensity\DTO\Input\ConfigDTO;
0 ignored issues
show
Bug introduced by
The type SavinMikhail\CommentsDensity\DTO\Input\ConfigDTO 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...
14
use SavinMikhail\CommentsDensity\Reporters\ReporterInterface;
15
use Symfony\Component\Console\Command\Command as SymfonyCommand;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
abstract class Command extends SymfonyCommand
19
{
20
    protected function getConfigDto(): ConfigDTO
21
    {
22
        $configLoader = new ConfigLoader();
23
        return $configLoader->getConfigDto();
24
    }
25
26
    protected function getFilesFromDirectories(array $directories): Generator
27
    {
28
        foreach ($directories as $directory) {
29
            $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
30
            foreach ($iterator as $file) {
31
                yield $file;
32
            }
33
        }
34
    }
35
}
36