| 1 | <?php |
||
| 16 | final class ControllerConfig |
||
| 17 | { |
||
| 18 | public const REDIRECT_RESPONSE_CODES = [201, 301, 302, 303, 307, 308]; |
||
| 19 | |||
| 20 | private $redirectResponseCode; |
||
| 21 | |||
| 22 | public function __construct(int $redirectResponseCode) |
||
| 23 | { |
||
| 24 | if (!\in_array($redirectResponseCode, self::REDIRECT_RESPONSE_CODES, true)) { |
||
| 25 | throw new InvalidArgumentException(sprintf('Invalid redirect response code "%s" (must be 201, 301, 302, 303, 307, or 308).', $redirectResponseCode)); |
||
| 26 | } |
||
| 27 | |||
| 28 | $this->redirectResponseCode = $redirectResponseCode; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function getRedirectResponseCode(): int |
||
| 35 | } |
||
| 36 |