Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| PresenterAbstract | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| present | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
| getViewModel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| withContext | |
100.00% |
2 / 2 |
|
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 Phexium\Presentation; |
| 11 | |
| 12 | use Override; |
| 13 | use Phexium\Application\ResponseInterface; |
| 14 | |
| 15 | abstract class PresenterAbstract implements PresenterInterface |
| 16 | { |
| 17 | protected array|object $viewModel; |
| 18 | |
| 19 | protected ?PresentationContextInterface $context = null; |
| 20 | |
| 21 | abstract public function present(ResponseInterface $response): self; |
| 22 | |
| 23 | #[Override] |
| 24 | public function getViewModel(): array|object |
| 25 | { |
| 26 | return $this->viewModel; |
| 27 | } |
| 28 | |
| 29 | #[Override] |
| 30 | public function withContext(PresentationContextInterface $context): self |
| 31 | { |
| 32 | $this->context = $context; |
| 33 | |
| 34 | return $this; |
| 35 | } |
| 36 | } |