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

30 lines
451 B
PHP
Raw Normal View History

2020-09-10 15:49:42 +08:00
<?php
namespace Snowflake\Abstracts;
use Exception;
use HttpServer\Exception\ExitException;
2020-09-10 15:58:03 +08:00
use Snowflake\Core\JSON;
2020-09-10 15:49:42 +08:00
/**
* Class BaseGoto
* @package Snowflake\Abstracts
*/
class BaseGoto extends Component
{
/**
* @param $message
* @param int $statusCode
2020-09-10 15:56:18 +08:00
* @return mixed|void
2020-09-10 15:49:42 +08:00
* @throws Exception
*/
2020-09-10 15:58:03 +08:00
public function end(string $message, $statusCode = 200)
2020-09-10 15:49:42 +08:00
{
2020-09-10 15:58:03 +08:00
throw new ExitException(JSON::to(12350, $message), $statusCode);
2020-09-10 15:49:42 +08:00
}
}