Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
11 / 11 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ListLoansHtmlPresenter | |
100.00% |
11 / 11 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| present | |
100.00% |
10 / 10 |
|
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\Presentation\PresenterAbstract; |
| 15 | use Phexium\Presentation\PresenterInterface; |
| 16 | |
| 17 | final class ListLoansHtmlPresenter extends PresenterAbstract implements PresenterInterface |
| 18 | { |
| 19 | public function present(ListLoansResponse $response): self |
| 20 | { |
| 21 | $pagination = $response->pagination; |
| 22 | |
| 23 | $this->viewModel = new ListLoansHtmlViewModel( |
| 24 | loans: $response->loans, |
| 25 | count: $pagination->totalCount, |
| 26 | page: $pagination->page, |
| 27 | totalPages: $pagination->getTotalPages(), |
| 28 | has_next_page: $pagination->hasNextPage(), |
| 29 | has_previous_page: $pagination->hasPreviousPage(), |
| 30 | ); |
| 31 | |
| 32 | return $this; |
| 33 | } |
| 34 | |
| 35 | #[Override] |
| 36 | public function getViewModel(): ListLoansHtmlViewModel |
| 37 | { |
| 38 | return $this->viewModel; |
| 39 | } |
| 40 | } |