Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ListLoansHtmlPresenter | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| present | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
| getViewModel | |
100.00% |
1 / 1 |
|
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 | |
| 8 | declare(strict_types=1); |
| 9 | |
| 10 | namespace AppDemo\Loan\Presentation; |
| 11 | |
| 12 | use AppDemo\Loan\Application\Query\ListLoansResponse; |
| 13 | use Override; |
| 14 | use Phexium\Application\ResponseInterface; |
| 15 | use Phexium\Domain\TypeGuard; |
| 16 | use Phexium\Presentation\PresenterAbstract; |
| 17 | use Phexium\Presentation\PresenterInterface; |
| 18 | |
| 19 | final class ListLoansHtmlPresenter extends PresenterAbstract implements PresenterInterface |
| 20 | { |
| 21 | #[Override] |
| 22 | public function present(ResponseInterface $response): self |
| 23 | { |
| 24 | TypeGuard::that($response)->isInstanceOf(ListLoansResponse::class); |
| 25 | |
| 26 | $loans = $response->loans; |
| 27 | |
| 28 | $this->viewModel = new ListLoansHtmlViewModel( |
| 29 | loans: $loans, |
| 30 | count: count($loans) |
| 31 | ); |
| 32 | |
| 33 | return $this; |
| 34 | } |
| 35 | |
| 36 | #[Override] |
| 37 | public function getViewModel(): ListLoansHtmlViewModel |
| 38 | { |
| 39 | return $this->viewModel; |
| 40 | } |
| 41 | } |