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