Passed
Pull Request — master (#22)
by Luis
24:40 queued 21:48
created

DigraphConfiguration   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 42
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0
wmc 6
1
<?php declare(strict_types=1);
2
/**
3
 * PHP version 8.1
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\CodeFinderConfiguration;
12
use PhUml\Parser\CodeParser;
13
use PhUml\Parser\CodeParserConfiguration;
14
use PhUml\Parser\SourceCodeFinder;
15
use PhUml\Processors\GraphvizConfiguration;
16
use PhUml\Processors\GraphvizProcessor;
17
use PhUml\Processors\OutputWriter;
18
use PhUml\Stages\ProgressDisplay;
19
use Symplify\SmartFileSystem\SmartFileSystem;
20
21
final class DigraphConfiguration
22
{
23
    private readonly CodeFinder $codeFinder;
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_STRING, expecting T_VARIABLE on line 23 at column 21
Loading history...
24
25
    private readonly CodeParser $codeParser;
26
27
    private readonly GraphvizProcessor $graphvizProcessor;
28
29
    private readonly OutputWriter $writer;
30
31
    /**
32
     * @param array{
33
     *     recursive: bool,
34
     *     associations: bool,
35
     *     "hide-private": bool,
36
     *     "hide-protected": bool,
37
     *     "hide-methods": bool,
38
     *     "hide-attributes": bool,
39
     *     "hide-empty-blocks": bool,
40
     *     theme: string
41
     *  } $options
42
     */
43 5
    public function __construct(array $options, private readonly ProgressDisplay $display)
44
    {
45 5
        $this->codeFinder = SourceCodeFinder::fromConfiguration(new CodeFinderConfiguration($options));
46 5
        $this->codeParser = CodeParser::fromConfiguration(new CodeParserConfiguration($options));
47 5
        $this->graphvizProcessor = GraphvizProcessor::fromConfiguration(new GraphvizConfiguration($options));
48 5
        $this->writer = new OutputWriter(new SmartFileSystem());
49
    }
50
51 5
    public function codeFinder(): CodeFinder
52
    {
53 5
        return $this->codeFinder;
54
    }
55
56 4
    public function codeParser(): CodeParser
57
    {
58 4
        return $this->codeParser;
59
    }
60
61 4
    public function graphvizProcessor(): GraphvizProcessor
62
    {
63 4
        return $this->graphvizProcessor;
64
    }
65
66 4
    public function writer(): OutputWriter
67
    {
68 4
        return $this->writer;
69
    }
70
71 4
    public function display(): ProgressDisplay
72
    {
73 4
        return $this->display;
74
    }
75
}
76