Fix formatting and interfaces in nearly every file
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
/**
|
||||
* Class AircraftPermissionDenied
|
||||
* @package App\Exceptions
|
||||
*/
|
||||
class AircraftPermissionDenied extends HttpException
|
||||
{
|
||||
public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
public function __construct(
|
||||
string $message = null,
|
||||
\Exception $previous = null,
|
||||
int $code = 0,
|
||||
array $headers = []
|
||||
) {
|
||||
parent::__construct(
|
||||
400,
|
||||
'User is not allowed to fly this aircraft',
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
/**
|
||||
* Class BidExists
|
||||
* @package App\Exceptions
|
||||
*/
|
||||
class BidExists extends HttpException
|
||||
{
|
||||
public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
public function __construct(
|
||||
string $message = null,
|
||||
\Exception $previous = null,
|
||||
int $code = 0,
|
||||
array $headers = []
|
||||
) {
|
||||
parent::__construct(
|
||||
409,
|
||||
'A bid already exists for this flight',
|
||||
|
||||
@@ -51,7 +51,7 @@ class Handler extends ExceptionHandler
|
||||
{
|
||||
return [
|
||||
'error' => [
|
||||
'status' => $status_code,
|
||||
'status' => $status_code,
|
||||
'message' => $message,
|
||||
]
|
||||
];
|
||||
@@ -60,19 +60,18 @@ class Handler extends ExceptionHandler
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
if ($request->is('api/*')) {
|
||||
|
||||
$headers = [];
|
||||
|
||||
Log::error('API Error', $exception->getTrace());
|
||||
|
||||
if($exception instanceof ModelNotFoundException ||
|
||||
if ($exception instanceof ModelNotFoundException ||
|
||||
$exception instanceof NotFoundHttpException) {
|
||||
$error = $this->createError(404, $exception->getMessage());
|
||||
}
|
||||
@@ -88,10 +87,10 @@ class Handler extends ExceptionHandler
|
||||
}
|
||||
|
||||
# Create the detailed errors from the validation errors
|
||||
elseif($exception instanceof ValidationException) {
|
||||
elseif ($exception instanceof ValidationException) {
|
||||
$error_messages = [];
|
||||
$errors = $exception->errors();
|
||||
foreach($errors as $field => $error) {
|
||||
foreach ($errors as $field => $error) {
|
||||
$error_messages[] = implode(', ', $error);
|
||||
}
|
||||
|
||||
@@ -107,7 +106,7 @@ class Handler extends ExceptionHandler
|
||||
}
|
||||
|
||||
# Only add trace if in dev
|
||||
if(config('app.env') === 'dev') {
|
||||
if (config('app.env') === 'dev') {
|
||||
$error['error']['trace'] = $exception->getTrace()[0];
|
||||
}
|
||||
|
||||
@@ -125,14 +124,15 @@ 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)
|
||||
{
|
||||
if ($request->expectsJson() || $request->is('api/*')) {
|
||||
$error = $this->createError(401, 'Unauthenticated');
|
||||
|
||||
return response()->json($error, 401);
|
||||
}
|
||||
|
||||
@@ -148,13 +148,13 @@ class Handler extends ExceptionHandler
|
||||
{
|
||||
$status = $e->getStatusCode();
|
||||
view()->replaceNamespace('errors', [
|
||||
resource_path('views/layouts/' . config('phpvms.skin') . '/errors'),
|
||||
resource_path('views/layouts/'.config('phpvms.skin').'/errors'),
|
||||
resource_path('views/errors'),
|
||||
__DIR__ . '/views',
|
||||
__DIR__.'/views',
|
||||
]);
|
||||
|
||||
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'),
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
/**
|
||||
* Class PirepCancelled
|
||||
* @package App\Exceptions
|
||||
*/
|
||||
class PirepCancelled extends HttpException
|
||||
{
|
||||
public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = [])
|
||||
{
|
||||
public function __construct(
|
||||
string $message = null,
|
||||
\Exception $previous = null,
|
||||
int $code = 0,
|
||||
array $headers = []
|
||||
) {
|
||||
parent::__construct(
|
||||
400,
|
||||
'PIREP has been cancelled, updates are not allowed',
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
/**
|
||||
* Class SettingNotFound
|
||||
* @package App\Exceptions
|
||||
*/
|
||||
class SettingNotFound extends HttpException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user