代码规范

This commit is contained in:
thinkphp
2015-12-25 17:58:35 +08:00
parent fe393032dd
commit 053801d8d5

View File

@@ -11,13 +11,15 @@
namespace think;
class Error {
class Error
{
/**
* 自定义异常处理
* @access public
* @param mixed $e 异常对象
*/
public static function appException($e) {
public static function appException($e)
{
$error = [
'message' => $e->getMessage(),
'file' => $e->getFile(),
@@ -40,7 +42,8 @@ class Error {
* @param int $errline 错误行数
* @return void
*/
public static function appError($errno, $errstr, $errfile, $errline) {
public static function appError($errno, $errstr, $errfile, $errline)
{
$errorStr = "[{$errno}] {$errstr} {$errfile}{$errline} 行.";
switch ($errno) {
case E_USER_ERROR:
@@ -59,7 +62,8 @@ class Error {
* 应用关闭处理
* @return void
*/
public static function appShutdown() {
public static function appShutdown()
{
// 记录日志
Log::save();
if ($e = error_get_last()) {
@@ -82,7 +86,8 @@ class Error {
* @param mixed $error 错误
* @param int $code
*/
public static function halt($error, $code = 1) {
public static function halt($error, $code = 1)
{
$message = is_array($error) ? $error['message'] : $error;
$code = is_array($error) ? $error['code'] : $code;