Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| RbacMiddlewareFactory | |
100.00% |
5 / 5 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| forPermission | |
100.00% |
4 / 4 |
|
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\Infrastructure; |
| 11 | |
| 12 | use AppDemo\Shared\Application\Middleware\RbacPermissionMiddleware; |
| 13 | use Psr\Http\Message\ResponseFactoryInterface; |
| 14 | |
| 15 | final readonly class RbacMiddlewareFactory |
| 16 | { |
| 17 | public function __construct( |
| 18 | private ResponseFactoryInterface $responseFactory |
| 19 | ) {} |
| 20 | |
| 21 | public function forPermission(string $permission): RbacPermissionMiddleware |
| 22 | { |
| 23 | return new RbacPermissionMiddleware( |
| 24 | $this->responseFactory, |
| 25 | $permission |
| 26 | ); |
| 27 | } |
| 28 | } |