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

30 lines
467 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-17 16:43:50 +08:00
use Http\Exception\ExitException;
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
* @throws ExitException
2020-09-10 15:49:42 +08:00
*/
2020-12-17 14:09:14 +08:00
public function end(string $message, $statusCode = 200): mixed
2020-09-10 15:49:42 +08:00
{
2020-12-24 11:12:23 +08:00
throw new ExitException(Json::to(12350, $message), $statusCode);
2020-09-10 15:49:42 +08:00
}
}