Passed
Push — master ( 1ba30a...8ac47c )
by Luis
01:05 queued 12s
created

ClassDiagramConfiguration::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 2
nop 2
dl 0
loc 11
ccs 10
cts 10
cp 1
crap 2
rs 9.9666
c 0
b 0
f 0
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 PhUml\Parser\CodeFinder;
9
use PhUml\Parser\CodeFinderConfiguration;
10
use PhUml\Parser\CodeParser;
11
use PhUml\Parser\CodeParserConfiguration;
12
use PhUml\Parser\SourceCodeFinder;
13
use PhUml\Processors\GraphvizConfiguration;
14
use PhUml\Processors\GraphvizProcessor;
15
use PhUml\Processors\ImageProcessor;
16
use PhUml\Processors\ImageProcessorName;
17
use PhUml\Processors\OutputWriter;
18
use PhUml\Stages\ProgressDisplay;
19
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...
20
21
final class ClassDiagramConfiguration
22
{
23
    private readonly CodeFinder $codeFinder;
24
25
    private readonly CodeParser $codeParser;
26
27
    private readonly GraphvizProcessor $graphvizProcessor;
28
29
    private readonly ImageProcessor $imageProcessor;
30
31
    private readonly OutputWriter $writer;
32
33
    /**
34
     * @param array{
35
     *     processor: string,
36
     *     recursive: bool,
37
     *     associations: bool,
38
     *     "hide-private": bool,
39
     *     "hide-protected": bool,
40
     *     "hide-methods": bool,
41
     *     "hide-attributes": bool,
42
     *     "hide-empty-blocks": bool,
43
     *     theme: string
44
     *  } $options
45
     */
46 8
    public function __construct(array $options, private readonly ProgressDisplay $display)
47
    {
48 8
        $this->codeFinder = SourceCodeFinder::fromConfiguration(new CodeFinderConfiguration($options));
0 ignored issues
show
Bug introduced by
The property codeFinder is declared read-only in PhUml\Generators\ClassDiagramConfiguration.
Loading history...
49 8
        $this->codeParser = CodeParser::fromConfiguration(new CodeParserConfiguration($options));
0 ignored issues
show
Bug introduced by
The property codeParser is declared read-only in PhUml\Generators\ClassDiagramConfiguration.
Loading history...
50 8
        $this->graphvizProcessor = GraphvizProcessor::fromConfiguration(new GraphvizConfiguration($options));
0 ignored issues
show
Bug introduced by
The property graphvizProcessor is declared read-only in PhUml\Generators\ClassDiagramConfiguration.
Loading history...
51 8
        $imageProcessorName = new ImageProcessorName($options['processor']);
52 7
        $filesystem = new SmartFileSystem();
53 7
        $this->imageProcessor = $imageProcessorName->isDot()
0 ignored issues
show
Bug introduced by
The property imageProcessor is declared read-only in PhUml\Generators\ClassDiagramConfiguration.
Loading history...
54 1
            ? ImageProcessor::dot($filesystem)
55 6
            : ImageProcessor::neato($filesystem);
56 7
        $this->writer = new OutputWriter($filesystem);
0 ignored issues
show
Bug introduced by
The property writer is declared read-only in PhUml\Generators\ClassDiagramConfiguration.
Loading history...
57
    }
58
59 7
    public function codeFinder(): CodeFinder
60
    {
61 7
        return $this->codeFinder;
62
    }
63
64 7
    public function codeParser(): CodeParser
65
    {
66 7
        return $this->codeParser;
67
    }
68
69 7
    public function graphvizProcessor(): GraphvizProcessor
70
    {
71 7
        return $this->graphvizProcessor;
72
    }
73
74 7
    public function imageProcessor(): ImageProcessor
75
    {
76 7
        return $this->imageProcessor;
77
    }
78
79 7
    public function writer(): OutputWriter
80
    {
81 7
        return $this->writer;
82
    }
83
84 7
    public function display(): ProgressDisplay
85
    {
86 7
        return $this->display;
87
    }
88
}
89