|
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\CreateClassDiagram; |
|
14
|
|
|
use PhUml\Stages\CreateDigraph; |
|
15
|
|
|
use PhUml\Stages\FindCode; |
|
16
|
|
|
use PhUml\Stages\ParseCode; |
|
17
|
|
|
use PhUml\Stages\SaveFile; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* It generates a UML class diagram from a directory with PHP code |
|
21
|
|
|
* |
|
22
|
|
|
* The image produced is a `.png` that will be saved in a specified path |
|
23
|
|
|
*/ |
|
24
|
|
|
final class ClassDiagramGenerator |
|
25
|
|
|
{ |
|
26
|
45 |
|
public static function fromConfiguration(ClassDiagramConfiguration $configuration): ClassDiagramGenerator |
|
27
|
|
|
{ |
|
28
|
|
|
return new self( |
|
29
|
|
|
new FindCode($configuration->codeFinder(), $configuration->display()), |
|
30
|
|
|
new ParseCode($configuration->codeParser(), $configuration->display()), |
|
31
|
45 |
|
new CreateDigraph($configuration->graphvizProcessor(), $configuration->display()), |
|
32
|
45 |
|
new CreateClassDiagram($configuration->imageProcessor(), $configuration->display()), |
|
33
|
45 |
|
new SaveFile($configuration->writer(), $configuration->display()), |
|
34
|
|
|
); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
private function __construct( |
|
38
|
|
|
private FindCode $findCode, |
|
39
|
|
|
private ParseCode $parseCode, |
|
40
|
|
|
private CreateDigraph $createDigraph, |
|
41
|
|
|
private CreateClassDiagram $createClassDiagram, |
|
42
|
|
|
private SaveFile $saveFile, |
|
43
|
|
|
) { |
|
44
|
|
|
} |
|
45
|
45 |
|
|
|
46
|
|
|
public function generate(GeneratorInput $input): void |
|
47
|
45 |
|
{ |
|
48
|
39 |
|
$pipeline = (new Pipeline()) |
|
49
|
39 |
|
->pipe($this->findCode) |
|
50
|
39 |
|
->pipe($this->parseCode) |
|
51
|
|
|
->pipe($this->createDigraph) |
|
52
|
|
|
->pipe($this->createClassDiagram) |
|
53
|
39 |
|
->pipe(fn (OutputContent $content) => $this->saveFile->saveTo($content, $input->filePath())); |
|
54
|
|
|
|
|
55
|
39 |
|
$pipeline->process($input->codebaseDirectory()); |
|
56
|
39 |
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|
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