1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
/** |
3
|
|
|
* PHP version 8.0 |
4
|
|
|
* |
5
|
|
|
* This source file is subject to the license that is bundled with this package in the file LICENSE. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace PhUml\Generators; |
9
|
|
|
|
10
|
|
|
use League\Pipeline\Pipeline; |
|
|
|
|
11
|
|
|
use PhUml\Console\Commands\GeneratorInput; |
12
|
|
|
use PhUml\Processors\OutputContent; |
13
|
|
|
use PhUml\Stages\CalculateStatistics; |
14
|
|
|
use PhUml\Stages\FindCode; |
15
|
|
|
use PhUml\Stages\ParseCode; |
16
|
|
|
use PhUml\Stages\SaveFile; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* It generates a text file with the statistics of an object oriented codebase |
20
|
|
|
* |
21
|
|
|
* It reports the number of classes and interfaces, number of private, public and protected methods |
22
|
|
|
* among other details |
23
|
|
|
*/ |
24
|
|
|
final class StatisticsGenerator |
25
|
|
|
{ |
26
|
15 |
|
public static function fromConfiguration(StatisticsGeneratorConfiguration $configuration): StatisticsGenerator |
27
|
|
|
{ |
28
|
15 |
|
return new StatisticsGenerator( |
29
|
15 |
|
new FindCode($configuration->codeFinder(), $configuration->display()), |
30
|
15 |
|
new ParseCode($configuration->codeParser(), $configuration->display()), |
31
|
|
|
new CalculateStatistics($configuration->statisticsProcessor(), $configuration->display()), |
32
|
|
|
new SaveFile($configuration->writer(), $configuration->display()), |
33
|
|
|
); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
private function __construct( |
37
|
|
|
private FindCode $findCode, |
38
|
|
|
private ParseCode $parseCode, |
39
|
|
|
private CalculateStatistics $calculateStatistics, |
40
|
|
|
private SaveFile $saveFile, |
41
|
|
|
) { |
42
|
12 |
|
} |
43
|
|
|
|
44
|
12 |
|
public function generate(GeneratorInput $input): void |
45
|
9 |
|
{ |
46
|
9 |
|
$pipeline = (new Pipeline()) |
47
|
9 |
|
->pipe($this->findCode) |
48
|
|
|
->pipe($this->parseCode) |
49
|
9 |
|
->pipe($this->calculateStatistics) |
50
|
|
|
->pipe(fn (OutputContent $content) => $this->saveFile->saveTo($content, $input->filePath())); |
51
|
9 |
|
|
52
|
9 |
|
$pipeline->process($input->codebaseDirectory()); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths