getCode() == 0 ? 500 : $throwable->getCode(); $array['message'] = $throwable->getMessage(); $array['param'] = [ 'file' => $throwable->getFile(), 'line' => $throwable->getLine() ]; return Json::encode($array); } /** * @param $state * @param $body * @return false|int|string * @throws Exception */ public static function output($state, $body): bool|int|string { $params['state'] = $state; $params['body'] = ArrayAccess::toArray($body); return static::encode($params); } }