Files
kiri-core/kiri-engine/Abstracts/BaseGoto.php
T

29 lines
429 B
PHP
Raw Normal View History

2020-09-10 15:49:42 +08:00
<?php
2020-10-29 18:17:25 +08:00
declare(strict_types=1);
2020-09-10 15:49:42 +08:00
2021-08-11 01:04:57 +08:00
namespace Kiri\Abstracts;
2020-09-10 15:49:42 +08:00
use Exception;
2021-08-11 01:04:57 +08:00
use Kiri\Core\Json;
2020-09-10 15:49:42 +08:00
/**
* Class BaseGoto
2021-08-11 01:04:57 +08:00
* @package Kiri\Abstracts
2020-09-10 15:49:42 +08:00
*/
class BaseGoto extends Component
{
/**
2020-12-17 14:09:14 +08:00
* @param string $message
2020-09-10 15:49:42 +08:00
* @param int $statusCode
2020-12-17 14:09:14 +08:00
* @return mixed
2021-09-18 16:54:39 +08:00
* @throws Exception
2020-09-10 15:49:42 +08:00
*/
2021-09-18 16:54:39 +08:00
public function end(string $message, int $statusCode = 200): mixed
2020-09-10 15:49:42 +08:00
{
2021-09-18 16:54:39 +08:00
throw new Exception(Json::to(12350, $message), $statusCode);
2020-09-10 15:49:42 +08:00
}
}