|
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\CreateDigraph; |
|
14
|
|
|
use PhUml\Stages\FindCode; |
|
15
|
|
|
use PhUml\Stages\ParseCode; |
|
16
|
|
|
use PhUml\Stages\SaveFile; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* It generates a file with a digraph in DOT format that can be used to create a class diagram |
|
20
|
|
|
* |
|
21
|
|
|
* You might want to create a different output using either `neato` or `dot`. |
|
22
|
|
|
* The file this command creates can be used as an intermediate step. |
|
23
|
|
|
* For instance: |
|
24
|
|
|
* |
|
25
|
|
|
* `neato -Tpdf output.gv > output.pdf` |
|
26
|
|
|
* |
|
27
|
|
|
* Where `output.gv` is the file generated by this action |
|
28
|
|
|
*/ |
|
29
|
|
|
final class DigraphGenerator |
|
30
|
|
|
{ |
|
31
|
4 |
|
public static function fromConfiguration(DigraphConfiguration $configuration): DigraphGenerator |
|
32
|
|
|
{ |
|
33
|
4 |
|
return new self( |
|
34
|
4 |
|
new FindCode($configuration->codeFinder(), $configuration->display()), |
|
35
|
4 |
|
new ParseCode($configuration->codeParser(), $configuration->display()), |
|
36
|
4 |
|
new CreateDigraph($configuration->graphvizProcessor(), $configuration->display()), |
|
37
|
4 |
|
new SaveFile($configuration->writer(), $configuration->display()), |
|
38
|
|
|
); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
4 |
|
private function __construct( |
|
42
|
|
|
private FindCode $findCode, |
|
43
|
|
|
private ParseCode $parseCode, |
|
44
|
|
|
private CreateDigraph $createDigraph, |
|
45
|
|
|
private SaveFile $saveFile, |
|
46
|
|
|
) { |
|
47
|
4 |
|
} |
|
48
|
|
|
|
|
49
|
3 |
|
public function generate(GeneratorInput $input): void |
|
50
|
|
|
{ |
|
51
|
3 |
|
$pipeline = (new Pipeline()) |
|
52
|
3 |
|
->pipe($this->findCode) |
|
53
|
3 |
|
->pipe($this->parseCode) |
|
54
|
3 |
|
->pipe($this->createDigraph) |
|
55
|
3 |
|
->pipe(fn (OutputContent $content) => $this->saveFile->saveTo($content, $input->filePath())); |
|
56
|
|
|
|
|
57
|
3 |
|
$pipeline->process($input->codebaseDirectory()); |
|
58
|
3 |
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|
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