Passed
Push — union-types ( b56600...45a674 )
by Luis
13:38
created

ClassDiagramConfiguration::display()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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 PhUml\Parser\CodeFinder;
11
use PhUml\Parser\CodeParser;
12
use PhUml\Parser\CodeParserConfiguration;
13
use PhUml\Parser\SourceCodeFinder;
14
use PhUml\Processors\GraphvizConfiguration;
15
use PhUml\Processors\GraphvizProcessor;
16
use PhUml\Processors\ImageProcessor;
17
use PhUml\Processors\ImageProcessorName;
18
use PhUml\Processors\OutputWriter;
19
use PhUml\Stages\ProgressDisplay;
20
use Symplify\SmartFileSystem\SmartFileSystem;
0 ignored issues
show
Bug introduced by
The type Symplify\SmartFileSystem\SmartFileSystem was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
22
final class ClassDiagramConfiguration
23
{
24
    private CodeFinder $codeFinder;
25
26
    private CodeParser $codeParser;
27
28
    private GraphvizProcessor $graphvizProcessor;
29
30
    private ImageProcessor $imageProcessor;
31
32
    private OutputWriter $writer;
33
34
    /** @param mixed[] $options */
35
    public function __construct(array $options, private ProgressDisplay $display)
36
    {
37
        $recursive = (bool) ($options['recursive'] ?? false);
38
        $this->codeFinder = $recursive ? SourceCodeFinder::recursive() : SourceCodeFinder::nonRecursive();
39
        $this->codeParser = CodeParser::fromConfiguration(new CodeParserConfiguration($options));
40
        $this->graphvizProcessor = GraphvizProcessor::fromConfiguration(new GraphvizConfiguration($options));
41
        $imageProcessorName = new ImageProcessorName($options['processor'] ?? '');
42
        $filesystem = new SmartFileSystem();
43
        $this->imageProcessor = $imageProcessorName->isDot()
44
            ? ImageProcessor::dot($filesystem)
45
            : ImageProcessor::neato($filesystem);
46
        $this->writer = new OutputWriter($filesystem);
47
    }
48
49
    public function codeFinder(): CodeFinder
50
    {
51
        return $this->codeFinder;
52
    }
53
54
    public function codeParser(): CodeParser
55
    {
56
        return $this->codeParser;
57
    }
58
59
    public function graphvizProcessor(): GraphvizProcessor
60
    {
61
        return $this->graphvizProcessor;
62
    }
63
64
    public function imageProcessor(): ImageProcessor
65
    {
66
        return $this->imageProcessor;
67
    }
68
69
    public function writer(): OutputWriter
70
    {
71
        return $this->writer;
72
    }
73
74
    public function display(): ProgressDisplay
75
    {
76
        return $this->display;
77
    }
78
}
79