Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
MyLoansHtmlPresenter
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 present
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 getViewModel
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3// ╔════════════════════════════════════════════════════════════╗
4// ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║
5// ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com>     ║
6// ╚════════════════════════════════════════════════════════════╝
7
8declare(strict_types=1);
9
10namespace AppDemo\Loan\Presentation;
11
12use AppDemo\Loan\Application\Query\MyLoansResponse;
13use Override;
14use Phexium\Presentation\PresenterAbstract;
15use Phexium\Presentation\PresenterInterface;
16
17final class MyLoansHtmlPresenter extends PresenterAbstract implements PresenterInterface
18{
19    private MyLoansHtmlViewModel $htmlViewModel;
20
21    public function present(MyLoansResponse $response): self
22    {
23        $this->htmlViewModel = new MyLoansHtmlViewModel(
24            loans: $response->loans,
25            count: count($response->loans)
26        );
27
28        return $this;
29    }
30
31    #[Override]
32    public function getViewModel(): MyLoansHtmlViewModel
33    {
34        return $this->htmlViewModel;
35    }
36}