ThrowsExceptionMiddleware.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  5. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  6. *
  7. * Licensed under The MIT License
  8. * For full copyright and license information, please see the LICENSE.txt
  9. * Redistributions of files must retain the above copyright notice.
  10. *
  11. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  12. * @link https://cakephp.org CakePHP(tm) Project
  13. * @since 3.6.2
  14. * @license https://opensource.org/licenses/mit-license.php MIT License
  15. */
  16. namespace TestApp\Middleware;
  17. use Cake\Http\Exception\ForbiddenException;
  18. use Psr\Http\Message\ResponseInterface;
  19. use Psr\Http\Message\ServerRequestInterface;
  20. use Psr\Http\Server\MiddlewareInterface;
  21. use Psr\Http\Server\RequestHandlerInterface;
  22. /**
  23. * Testing stub for middleware tests.
  24. */
  25. class ThrowsExceptionMiddleware implements MiddlewareInterface
  26. {
  27. public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
  28. {
  29. throw new ForbiddenException('Sample Message');
  30. }
  31. }