Apply fixes from StyleCI

This commit is contained in:
Nabeel Shahzad
2018-08-26 16:40:04 +00:00
committed by StyleCI Bot
parent 20f46adbc4
commit 9596d88b48
407 changed files with 4032 additions and 3286 deletions

View File

@@ -13,7 +13,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Class Handler
* @package App\Exceptions
*/
class Handler extends ExceptionHandler
{
@@ -32,9 +31,12 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
* @param \Exception $exception
* @return void
*
* @param \Exception $exception
*
* @throws Exception
*
* @return void
*/
public function report(Exception $exception)
{
@@ -43,8 +45,10 @@ class Handler extends ExceptionHandler
/**
* Create an error message
*
* @param $status_code
* @param $message
*
* @return array
*/
protected function createError($status_code, $message)
@@ -53,15 +57,16 @@ class Handler extends ExceptionHandler
'error' => [
'status' => $status_code,
'message' => $message,
]
],
];
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
*
* @return mixed
*/
public function render($request, Exception $exception)
@@ -76,7 +81,7 @@ class Handler extends ExceptionHandler
$error = $this->createError(404, $exception->getMessage());
}
# Custom exceptions should be extending HttpException
// Custom exceptions should be extending HttpException
elseif ($exception instanceof HttpException) {
$error = $this->createError(
$exception->getStatusCode(),
@@ -86,7 +91,7 @@ class Handler extends ExceptionHandler
$headers = $exception->getHeaders();
}
# Create the detailed errors from the validation errors
// Create the detailed errors from the validation errors
elseif ($exception instanceof ValidationException) {
$error_messages = [];
$errors = $exception->errors();
@@ -99,13 +104,11 @@ class Handler extends ExceptionHandler
$error['error']['errors'] = $errors;
Log::error('Validation errors', $errors);
}
else {
} else {
$error = $this->createError(400, $exception->getMessage());
}
# Only add trace if in dev
// Only add trace if in dev
if (config('app.env') === 'dev') {
$error['error']['trace'] = $exception->getTrace()[0];
}
@@ -124,8 +127,9 @@ class Handler extends ExceptionHandler
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
*
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
@@ -140,7 +144,9 @@ class Handler extends ExceptionHandler
/**
* Render the given HttpException.
*
* @param HttpException $e
*
* @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response
*/
protected function renderHttpException(HttpException $e)
@@ -153,7 +159,7 @@ class Handler extends ExceptionHandler
]);
if (view()->exists("errors::{$status}")) {
#if (view()->exists('layouts' . config('phpvms.skin') .'.errors.' .$status)) {
//if (view()->exists('layouts' . config('phpvms.skin') .'.errors.' .$status)) {
return response()->view("errors::{$status}", [
'exception' => $e,
'SKIN_NAME' => config('phpvms.skin'),