Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| PresentationContext | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| userCan | |
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\Shared\Presentation; |
| 11 | |
| 12 | use AppDemo\Shared\Domain\UserContext; |
| 13 | use Phexium\Presentation\PresentationContextInterface; |
| 14 | |
| 15 | final readonly class PresentationContext implements PresentationContextInterface |
| 16 | { |
| 17 | public function __construct(private UserContext $userContext) {} |
| 18 | |
| 19 | public function userCan(string $permission): bool |
| 20 | { |
| 21 | return $this->userContext->can($permission); |
| 22 | } |
| 23 | } |