Passed
Push — union-types ( b56600 )
by Luis
14:03
created

ParseCode   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 1
A __construct() 0 4 1
1
<?php declare(strict_types=1);
2
/**
3
 * PHP version 7.4
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\Stages;
9
10
use PhUml\Code\Codebase;
11
use PhUml\Parser\CodeParser;
12
use PhUml\Parser\SourceCode;
13
14
final class ParseCode
15
{
16
    private CodeParser $codeParser;
17
18
    private ProgressDisplay $display;
19
20
    public function __construct(CodeParser $codeParser, ProgressDisplay $display)
21
    {
22
        $this->codeParser = $codeParser;
23
        $this->display = $display;
24
    }
25
26
    public function __invoke(SourceCode $sourceCode): Codebase
27
    {
28
        $this->display->runningParser();
29
        return $this->codeParser->parse($sourceCode);
30
    }
31
}
32