1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
/** |
3
|
|
|
* This source file is subject to the license that is bundled with this package in the file LICENSE. |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace PhUml\Generators; |
7
|
|
|
|
8
|
|
|
use League\Pipeline\Pipeline; |
|
|
|
|
9
|
|
|
use PhUml\Console\Commands\GeneratorInput; |
10
|
|
|
use PhUml\Processors\OutputContent; |
11
|
|
|
use PhUml\Stages\CreateClassDiagram; |
12
|
|
|
use PhUml\Stages\CreateDigraph; |
13
|
|
|
use PhUml\Stages\FindCode; |
14
|
|
|
use PhUml\Stages\ParseCode; |
15
|
|
|
use PhUml\Stages\SaveFile; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* It generates a UML class diagram from a directory with PHP code |
19
|
|
|
* |
20
|
|
|
* The image produced is a `.png` that will be saved in a specified path |
21
|
|
|
*/ |
22
|
|
|
final class ClassDiagramGenerator |
23
|
|
|
{ |
24
|
7 |
|
public static function fromConfiguration(ClassDiagramConfiguration $configuration): ClassDiagramGenerator |
25
|
|
|
{ |
26
|
7 |
|
return new self( |
27
|
7 |
|
new FindCode($configuration->codeFinder(), $configuration->display()), |
28
|
7 |
|
new ParseCode($configuration->codeParser(), $configuration->display()), |
29
|
7 |
|
new CreateDigraph($configuration->graphvizProcessor(), $configuration->display()), |
30
|
7 |
|
new CreateClassDiagram($configuration->imageProcessor(), $configuration->display()), |
31
|
7 |
|
new SaveFile($configuration->writer(), $configuration->display()), |
32
|
|
|
); |
33
|
|
|
} |
34
|
|
|
|
35
|
7 |
|
private function __construct( |
36
|
|
|
private readonly FindCode $findCode, |
37
|
|
|
private readonly ParseCode $parseCode, |
38
|
|
|
private readonly CreateDigraph $createDigraph, |
39
|
|
|
private readonly CreateClassDiagram $createClassDiagram, |
40
|
|
|
private readonly SaveFile $saveFile, |
41
|
|
|
) { |
42
|
|
|
} |
43
|
|
|
|
44
|
6 |
|
public function generate(GeneratorInput $input): void |
45
|
|
|
{ |
46
|
6 |
|
$pipeline = (new Pipeline()) |
47
|
6 |
|
->pipe($this->findCode) |
48
|
6 |
|
->pipe($this->parseCode) |
49
|
6 |
|
->pipe($this->createDigraph) |
50
|
6 |
|
->pipe($this->createClassDiagram) |
51
|
6 |
|
->pipe(fn (OutputContent $content) => $this->saveFile->saveTo($content, $input->filePath())); |
52
|
|
|
|
53
|
6 |
|
$pipeline->process($input->codebaseDirectory()); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
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