Passed
Push — master ( a496c4...b086ac )
by
unknown
17:35
created

StopActionException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 4
dl 0
loc 4
rs 10
c 0
b 0
f 0
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 TYPO3\CMS\Extbase\Mvc\Exception;
21
use TYPO3\CMS\Extbase\Mvc\Response;
22
use TYPO3\CMS\Extbase\Mvc\ResponseInterface;
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
}
50