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