[BUGFIX] Fix PHP 8.0 issues in EXT:setup
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Mvc / Exception / StopActionException.php
1 <?php
2
3 declare(strict_types=1);
4
5 /*
6 * This file is part of the TYPO3 CMS project.
7 *
8 * It is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, either version 2
10 * of the License, or any later version.
11 *
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
14 *
15 * The TYPO3 project - inspiring people to share!
16 */
17
18 namespace TYPO3\CMS\Extbase\Mvc\Exception;
19
20 use Psr\Http\Message\ResponseInterface;
21 use TYPO3\CMS\Core\Http\Response;
22 use TYPO3\CMS\Extbase\Mvc\Exception;
23
24 /**
25 * This exception is thrown by a controller to stop the execution of the current
26 * action and return the control to the dispatcher. The dispatcher catches this
27 * exception and - depending on the "dispatched" status of the request - either
28 * continues dispatching the request or returns control to the request handler.
29 *
30 * See the Action Controller's forward() and redirectToUri() methods for more information.
31 */
32 class StopActionException extends Exception
33 {
34 /**
35 * @var ResponseInterface
36 */
37 private $response;
38
39 public function __construct($message = '', $code = 0, \Throwable $previous = null, ResponseInterface $response = null)
40 {
41 $this->response = $response ?? new Response();
42 parent::__construct($message, $code, $previous);
43 }
44
45 public function getResponse(): ResponseInterface
46 {
47 return $this->response;
48 }
49 }