Upgrade to 3.6.0

This commit is contained in:
Bastian Allgeier
2021-11-16 14:53:37 +01:00
parent 7388fa4d24
commit 92b7a330fa
318 changed files with 20017 additions and 6878 deletions

46
kirby/src/Panel/Redirect.php Executable file
View File

@@ -0,0 +1,46 @@
<?php
namespace Kirby\Panel;
use Exception;
/**
* The Redirect exception can be thrown in all Fiber
* routes to send a redirect response. It is
* primarily used in `Panel::go($location)`
* @since 3.6.0
*
* @package Kirby Panel
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Redirect extends Exception
{
/**
* Returns the HTTP code for the redirect
*
* @return int
*/
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
*
* @return string
*/
public function location(): string
{
return $this->getMessage();
}
}