Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
TextNotificationRenderer
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 render
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Notification\Infrastructure\Renderer;
4
5use App\Notification\Domain\Model\Notification;
6use App\Notification\Infrastructure\Sender\NotificationSender;
7use Twig\Environment;
8
9/**
10 * @author Wilhelm Zwertvaegher
11 */
12class TextNotificationRenderer implements NotificationRenderer
13{
14
15    public function __construct(
16        private Environment $twig,
17    )
18    {
19    }
20
21    public function render(Notification $notification, NotificationSender $sender): string
22    {
23        return $this->twig->render(
24            'notifications/'
25            . $sender->getName() . '/'
26            . $notification->getType()->value . '.txt.twig',
27            $notification->getPayload()
28        );
29    }
30}