Skip to content

Commit d6de263

Browse files
author
Mads Møller
authored
Merge pull request #24 from Napp/analysis-x0BjDa
Apply fixes from StyleCI
2 parents 43440d1 + f62932b commit d6de263

File tree

14 files changed

+47
-47
lines changed

14 files changed

+47
-47
lines changed

src/Auth/ApiGuard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Napp\Core\Api\Auth;
44

5-
use Illuminate\Http\Request;
65
use Illuminate\Auth\TokenGuard;
76
use Illuminate\Contracts\Auth\UserProvider;
7+
use Illuminate\Http\Request;
88

99
/**
1010
* Class ApiGuard.

src/Auth/AuthServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function boot()
3030
}
3131

3232
/**
33-
* Get the config path
33+
* Get the config path.
3434
*
3535
* @return string
3636
*/

src/Controllers/ApiController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Napp\Core\Api\Controllers;
44

5-
use Illuminate\Http\Request;
65
use Illuminate\Http\JsonResponse;
6+
use Illuminate\Http\Request;
77
use Illuminate\Support\Facades\Response;
88

99
/**

src/Controllers/ApiInternalController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace Napp\Core\Api\Controllers;
44

5-
use Illuminate\Http\Response;
65
use Illuminate\Auth\AuthManager;
7-
use Napp\Core\Api\Router\Router;
86
use Illuminate\Http\JsonResponse;
7+
use Illuminate\Http\Response;
98
use Napp\Core\Api\Auth\NappHttpHeaders;
109
use Napp\Core\Api\Exceptions\Exceptions\ApiInternalCallException;
10+
use Napp\Core\Api\Router\Router;
1111

1212
/**
1313
* Class ApiInternalController.

src/Controllers/ApiProxyController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Napp\Core\Api\Controllers;
44

5-
use Illuminate\Http\Request;
65
use Illuminate\Http\JsonResponse;
6+
use Illuminate\Http\Request;
77

88
/**
99
* Class ApiProxyController.

src/Controllers/BaseController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Napp\Core\Api\Controllers;
44

5-
use Illuminate\Routing\Controller;
5+
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
66
use Illuminate\Foundation\Bus\DispatchesJobs;
77
use Illuminate\Foundation\Validation\ValidatesRequests;
8-
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
8+
use Illuminate\Routing\Controller;
99

1010
/**
1111
* Class BaseController.

src/Exceptions/NappApiHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace Napp\Core\Api\Exceptions;
44

55
use Illuminate\Http\JsonResponse;
6-
use Napp\Core\Api\Exceptions\Renderer\Renderer;
6+
use Napp\Core\Api\Exceptions\Exceptions\Exception as NappException;
77
use Napp\Core\Api\Exceptions\Renderer\DebugRenderer;
8+
use Napp\Core\Api\Exceptions\Renderer\Renderer;
89
use Napp\Core\Api\Exceptions\Renderer\RendererInterface;
9-
use Napp\Core\Api\Exceptions\Exceptions\Exception as NappException;
1010

1111
/**
1212
* Class NappApiHandler.

src/Exceptions/Renderer/DebugRenderer.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ public function render(): JsonResponse
5050

5151
return response()->json(
5252
[
53-
'error' => [
54-
'code' => $this->statusCode,
55-
'message' => $this->statusMessage,
56-
'type' => \get_class($this->exception),
57-
'file' => $this->exception->getFile(),
58-
'line' => $this->exception->getLine(),
59-
'trace' => $this->formatTrace($this->exception->getTrace()),
60-
], ],
53+
'error' => [
54+
'code' => $this->statusCode,
55+
'message' => $this->statusMessage,
56+
'type' => \get_class($this->exception),
57+
'file' => $this->exception->getFile(),
58+
'line' => $this->exception->getLine(),
59+
'trace' => $this->formatTrace($this->exception->getTrace()),
60+
], ],
6161
$this->responseCode
6262
);
6363
}

src/Exceptions/Renderer/Renderer.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public function render(): JsonResponse
4242

4343
return response()->json(
4444
[
45-
'error' => [
46-
'code' => $this->statusCode,
47-
'message' => $this->statusMessage,
48-
], ],
45+
'error' => [
46+
'code' => $this->statusCode,
47+
'message' => $this->statusMessage,
48+
], ],
4949
$this->responseCode
5050
);
5151
}
@@ -54,10 +54,10 @@ public function render(): JsonResponse
5454
case 400:
5555
return response()->json(
5656
[
57-
'error' => [
58-
'code' => $this->statusCode,
59-
'message' => 'Unprocessable Entity',
60-
], ],
57+
'error' => [
58+
'code' => $this->statusCode,
59+
'message' => 'Unprocessable Entity',
60+
], ],
6161
$this->responseCode
6262
);
6363
case 401:
@@ -81,28 +81,28 @@ public function render(): JsonResponse
8181
case 404:
8282
return response()->json(
8383
[
84-
'error' => [
85-
'code' => $this->statusCode,
86-
'message' => 'Not Found',
87-
], ],
84+
'error' => [
85+
'code' => $this->statusCode,
86+
'message' => 'Not Found',
87+
], ],
8888
$this->responseCode
8989
);
9090
case 405:
9191
return response()->json(
9292
[
93-
'error' => [
94-
'code' => $this->statusCode,
95-
'message' => 'Method Not Allowed',
96-
], ],
93+
'error' => [
94+
'code' => $this->statusCode,
95+
'message' => 'Method Not Allowed',
96+
], ],
9797
$this->responseCode
9898
);
9999
default:
100100
return response()->json(
101101
[
102-
'error' => [
103-
'code' => $this->statusCode,
104-
'message' => 'Internal Server Error',
105-
], ],
102+
'error' => [
103+
'code' => $this->statusCode,
104+
'message' => 'Internal Server Error',
105+
], ],
106106
500
107107
);
108108
}

src/Requests/ApiRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function validateInputFields(): void
5858
$rules = $this->rules();
5959
if (false === empty(array_diff_key($input, $rules))) {
6060
$exception = new InvalidFieldException();
61-
$exception->statusMessage = $exception->statusMessage.': '.implode(',', array_keys(array_diff_key($input, $rules)));
61+
$exception->statusMessage = $exception->statusMessage . ': ' . implode(',', array_keys(array_diff_key($input, $rules)));
6262

6363
throw $exception;
6464
}
@@ -114,7 +114,7 @@ protected function handleApiCallFailedValidation(Validator $validator)
114114
{
115115
$message = $validator->messages()->first();
116116
$exception = new ValidationException();
117-
$exception->statusMessage = $exception->statusMessage.': '.$message;
117+
$exception->statusMessage = $exception->statusMessage . ': ' . $message;
118118
$exception->validation = $this->transformValidationOutput($validator);
119119

120120
throw $exception;

0 commit comments

Comments
 (0)