芝麻web文件管理V1.00
编辑当前文件:/home/sditechnicalteam/public_html/vendor/froiden/laravel-rest-api/src/Exceptions/ApiException.php
statusCode = $statusCode; } if ($code !== null) { $this->code = $code; } if ($innerError !== null) { $this->innerError = $innerError; } if (!empty($details)) { $this->details = $details; } if ($message == null) { parent::__construct($this->message, $this->code, $previous); } else { parent::__construct($message, $this->code, $previous); } } public function __toString() { return "ApiException (#{$this->getCode()}): {$this->getMessage()}"; } /** * Return the status code the response should be sent with * * @return int */ public function getStatusCode() { return $this->statusCode; } /** * Convert the exception to its JSON representation. * * @param int $options * @return string */ public function toJson($options = 0) { return json_encode($this->jsonSerialize(), $options); } /** * Specify data which should be serialized to JSON * @link http://php.net/manual/en/jsonserializable.jsonserialize.php * @return mixed data which can be serialized by
json_encode
, * which is a value of any type other than a resource. */ public function jsonSerialize() { $jsonArray = [ "error" => [ "message" => $this->getMessage(), "code" => $this->getCode() ] ]; if (isset($this->details)) { $jsonArray["error"]["details"] = $this->details; } if (isset($this->innerError)) { $jsonArray["error"]["innererror"] = [ "code" => $this->innerError ]; } return $jsonArray; } }