* @link https://getkirby.com * @copyright Bastian Allgeier * @license https://getkirby.com/license */ class Redirect extends Exception { /** * Returns the HTTP code for the redirect */ public function code(): int { $codes = [301, 302, 303, 307, 308]; if (in_array($this->getCode(), $codes) === true) { return $this->getCode(); } return 302; } /** * Returns the URL for the redirect */ public function location(): string { return $this->getMessage(); } }