Skip to content

Commit 10803af

Browse files
committed
Merge pull request silverbux#19 from silverbux/analysis-qBodxr
Applied fixes from StyleCI
2 parents 7dbc3e3 + e6794b4 commit 10803af

24 files changed

+134
-127
lines changed

app/Http/Controllers/AngularController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class AngularController extends Controller
66
{
77
/**
8-
* Serve the angular application
8+
* Serve the angular application.
99
*
1010
* @return JSON
1111
*/
@@ -15,7 +15,7 @@ public function serveApp()
1515
}
1616

1717
/**
18-
* Page for unsupported browsers
18+
* Page for unsupported browsers.
1919
*
2020
* @return JSON
2121
*/

app/Http/Controllers/Auth/AuthController.php

+15-16
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,30 @@
22

33
namespace App\Http\Controllers\Auth;
44

5-
use Auth;
6-
use JWTAuth;
7-
use App\User;
8-
use Illuminate\Http\Request;
95
use App\Http\Controllers\Controller;
10-
use Socialite;
6+
use App\User;
7+
use Auth;
118
use Bican\Roles\Models\Role;
12-
use Bican\Roles\Models\Permission;
9+
use Illuminate\Http\Request;
10+
use JWTAuth;
1311
use Mail;
12+
use Socialite;
1413

1514
class AuthController extends Controller
1615
{
1716
/**
18-
* Get all roles and their corresponding permissions
17+
* Get all roles and their corresponding permissions.
1918
*
20-
* @return Array
19+
* @return array
2120
*/
2221
private function getRolesAbilities()
2322
{
24-
$abilities = array();
23+
$abilities = [];
2524
$roles = Role::all();
2625

2726
foreach ($roles as $role) {
2827
if (!empty($role->slug)) {
29-
$abilities[$role->slug] = array();
28+
$abilities[$role->slug] = [];
3029
$rolePermission = $role->permissions()->get();
3130

3231
foreach ($rolePermission as $permission) {
@@ -41,7 +40,7 @@ private function getRolesAbilities()
4140
}
4241

4342
/**
44-
* Get authenticated user details and auth credentials
43+
* Get authenticated user details and auth credentials.
4544
*
4645
* @return JSON
4746
*/
@@ -51,7 +50,7 @@ public function getAuthenticatedUser()
5150
$user = Auth::user();
5251
$token = JWTAuth::fromUser($user);
5352
$abilities = $this->getRolesAbilities();
54-
$userRole = array();
53+
$userRole = [];
5554

5655
foreach ($user->Roles as $role) {
5756
$userRole [] = $role->slug;
@@ -116,7 +115,7 @@ private function findOrCreateUser($oauthUser, $provider)
116115
'email' => $oauthUser->email,
117116
'oauth_provider' => $provider,
118117
'oauth_provider_id' => $oauthUser->getId(),
119-
'avatar' => $oauthUser->avatar
118+
'avatar' => $oauthUser->avatar,
120119
]);
121120
}
122121

@@ -143,7 +142,7 @@ public function postLogin(Request $request)
143142
}
144143

145144
try {
146-
if (! $token = JWTAuth::attempt($credentials)) {
145+
if (!$token = JWTAuth::attempt($credentials)) {
147146
return response()->error('Invalid credentials', 401);
148147
}
149148
} catch (\JWTException $e) {
@@ -153,7 +152,7 @@ public function postLogin(Request $request)
153152
$user = Auth::user();
154153
$token = JWTAuth::fromUser($user);
155154
$abilities = $this->getRolesAbilities();
156-
$userRole = array();
155+
$userRole = [];
157156

158157
foreach ($user->Roles as $role) {
159158
$userRole [] = $role->slug;
@@ -192,7 +191,7 @@ public function postRegister(Request $request)
192191
]);
193192

194193
$verificationCode = str_random(40);
195-
$user = new User;
194+
$user = new User();
196195
$user->name = trim($request->name);
197196
$user->email = trim(strtolower($request->email));
198197
$user->password = bcrypt($request->password);

app/Http/Controllers/Auth/PasswordResetController.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace App\Http\Controllers\Auth;
44

5-
use Mail;
6-
use App\User;
5+
use App\Http\Controllers\Controller;
76
use App\PasswordReset;
7+
use App\User;
88
use Illuminate\Http\Request;
9-
use App\Http\Controllers\Controller;
9+
use Mail;
1010

1111
class PasswordResetController extends Controller
1212
{
@@ -47,7 +47,7 @@ public function verify(Request $request)
4747
->whereToken($request->token)
4848
->first();
4949

50-
if (! $check) {
50+
if (!$check) {
5151
return response()->error('Email does not exist', 422);
5252
}
5353

app/Http/Controllers/Controller.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace App\Http\Controllers;
44

5+
use Dingo\Api\Exception\ValidationHttpException;
56
use Dingo\Api\Http\Request;
7+
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
68
use Illuminate\Foundation\Bus\DispatchesJobs;
7-
use Dingo\Api\Exception\ValidationHttpException;
8-
use Illuminate\Routing\Controller as BaseController;
99
use Illuminate\Foundation\Validation\ValidatesRequests;
10-
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
10+
use Illuminate\Routing\Controller as BaseController;
1111

1212
class Controller extends BaseController
1313
{

0 commit comments

Comments
 (0)