TwigTemplateGenerator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 18
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A generateHtml() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chemaclass\StockTicker\Domain\Notifier\Channel;
6
7
use Chemaclass\StockTicker\Domain\Notifier\NotifyResult;
8
use Twig;
9
10
final class TwigTemplateGenerator implements TemplateGeneratorInterface
11
{
12
    private Twig\Environment $twig;
13
14
    private string $templateName;
15
16
    public function __construct(Twig\Environment $twig, string $templateName)
17
    {
18
        $this->twig = $twig;
19
        $this->templateName = $templateName;
20
    }
21
22
    public function generateHtml(NotifyResult $notifyResult): string
23
    {
24
        return $this->twig->render(
25
            $this->templateName,
26
            [
27
                'notifyResult' => $notifyResult,
28
            ],
29
        );
30
    }
31
}
32