Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| AuthProtectedRequestHandler | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| handle | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Core\Bootstrap\Dispatcher\Handler; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use App\Modules\User\Presentation\Middleware\AuthenticatedOnlyMiddleware; |
| 12 | use Psr\Http\Message\ResponseInterface; |
| 13 | use Psr\Http\Message\ServerRequestInterface; |
| 14 | use Psr\Http\Server\RequestHandlerInterface; |
| 15 | |
| 16 | final readonly class AuthProtectedRequestHandler implements RequestHandlerInterface |
| 17 | { |
| 18 | public function __construct( |
| 19 | private AuthenticatedOnlyMiddleware $authMiddleware, |
| 20 | private RequestHandlerInterface $next |
| 21 | ) { |
| 22 | } |
| 23 | |
| 24 | public function handle(ServerRequestInterface $request): ResponseInterface |
| 25 | { |
| 26 | return $this->authMiddleware->process($request, $this->next); |
| 27 | } |
| 28 | } |