Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
HomeUseCase
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 __invoke
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
2
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\Homepage\Application\UseCase;
11
12use Phexium\Application\UseCase\UseCaseInterface;
13use Phexium\Plugin\Clock\Port\ClockInterface;
14
15final readonly class HomeUseCase implements UseCaseInterface
16{
17    public function __construct(
18        private ClockInterface $clock
19    ) {}
20
21    public function __invoke(HomeRequest $request): HomeResponse
22    {
23        $greeting = $request->userEmail
24            ? sprintf('Welcome, %s', $request->userEmail)
25            : 'Welcome to CleanShelf';
26
27        $messageOfTheDay = 'Reading is a window to a magical world.';
28
29        $currentDateTime = $this->clock->now();
30
31        return new HomeResponse($greeting, $messageOfTheDay, $currentDateTime);
32    }
33}