Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| HomePresenter | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| present | |
100.00% |
6 / 6 |
|
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 AppStarter\Homepage\Presentation; |
| 11 | |
| 12 | use AppStarter\Homepage\Application\UseCase\HomeResponse; |
| 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 HomePresenter extends PresenterAbstract implements PresenterInterface |
| 20 | { |
| 21 | #[Override] |
| 22 | public function present(ResponseInterface $response): self |
| 23 | { |
| 24 | TypeGuard::that($response)->isInstanceOf(HomeResponse::class); |
| 25 | |
| 26 | $this->viewModel = (object) [ |
| 27 | 'greeting' => $response->greeting, |
| 28 | 'currentDateTime' => $response->currentDateTime->format('Y-m-d H:i:s'), |
| 29 | ]; |
| 30 | |
| 31 | return $this; |
| 32 | } |
| 33 | } |