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

StatisticsProcessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 19
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 0
wmc 3
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\Processors;
9
10
use PhUml\Code\Codebase;
11
use PhUml\Code\Summary;
12
use PhUml\Templates\TemplateEngine;
13
use PhUml\Templates\TemplateFailure;
14
15
/**
16
 * It takes a code `Structure` and extracts a `Summary` of its contents as text
17
 */
18
final class StatisticsProcessor implements Processor
19
{
20 7
    public function __construct(private readonly TemplateEngine $engine)
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_STRING, expecting T_VARIABLE on line 20 at column 49
Loading history...
21
    {
22
    }
23
24 5
    public function name(): string
25
    {
26 5
        return 'Statistics';
27
    }
28
29
    /**
30
     * @throws TemplateFailure
31
     */
32 4
    public function process(Codebase $codebase): OutputContent
33
    {
34 4
        $summary = Summary::from($codebase);
35
36 4
        return new OutputContent($this->engine->render('statistics.txt.twig', ['summary' => $summary]));
37
    }
38
}
39