Completed
Pull Request — development (#323)
by Claudio
10:48 queued 06:38
created
app/Http/Controllers/AccountSecurityController.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@
 block discarded – undo
200 200
      *
201 201
      * @param Request $request
202 202
      *
203
-     * @return mixed
203
+     * @return JsonResponse
204 204
      */
205 205
     public function confirmChangePassword(Request $request): JsonResponse
206 206
     {
Please login to merge, or discard this patch.
Switch Indentation   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -1,89 +1,89 @@  discard block
 block discarded – undo
1
-<?php
2
-
3
-namespace App\Http\Controllers;
4
-
5
-use App\Facades\Mail;
6
-use App\Facades\User as UserFacade;
7
-use App\Models\ChocolateyId;
8
-use App\Models\Question;
9
-use App\Models\TrustedDevice;
10
-use App\Models\User;
11
-use App\Models\UserSecurity;
12
-use Illuminate\Http\JsonResponse;
13
-use Illuminate\Http\Request;
14
-use Illuminate\Http\Response;
15
-use Illuminate\Support\Facades\Config;
16
-use Laravel\Lumen\Routing\Controller as BaseController;
1
+ <?php
2
+
3
+ namespace App\Http\Controllers;
4
+
5
+ use App\Facades\Mail;
6
+ use App\Facades\User as UserFacade;
7
+ use App\Models\ChocolateyId;
8
+ use App\Models\Question;
9
+ use App\Models\TrustedDevice;
10
+ use App\Models\User;
11
+ use App\Models\UserSecurity;
12
+ use Illuminate\Http\JsonResponse;
13
+ use Illuminate\Http\Request;
14
+ use Illuminate\Http\Response;
15
+ use Illuminate\Support\Facades\Config;
16
+ use Laravel\Lumen\Routing\Controller as BaseController;
17 17
 
18 18
 /**
19 19
  * Class AccountSecurityController.
20 20
  */
21
-class AccountSecurityController extends BaseController
22
-{
23
-    /**
21
+ class AccountSecurityController extends BaseController
22
+ {
23
+     /**
24 24
      * Check if Feature Status is Enabled.
25 25
      *
26 26
      * @return Response
27 27
      */
28
-    public function featureStatus(): Response
29
-    {
30
-        if (UserFacade::getUser()->emailVerified == false) {
31
-            return response('identity_verification_required', 200);
32
-        }
28
+     public function featureStatus(): Response
29
+     {
30
+         if (UserFacade::getUser()->emailVerified == false) {
31
+             return response('identity_verification_required', 200);
32
+         }
33 33
 
34
-        $featureEnabled = UserSecurity::find(UserFacade::getUser()->uniqueId);
34
+         $featureEnabled = UserSecurity::find(UserFacade::getUser()->uniqueId);
35 35
 
36
-        return response($featureEnabled !== null ? 'enabled' : 'disabled', 200);
37
-    }
36
+         return response($featureEnabled !== null ? 'enabled' : 'disabled', 200);
37
+     }
38 38
 
39
-    /**
39
+     /**
40 40
      * Save Security Questions.
41 41
      *
42 42
      * @param Request $request
43 43
      *
44 44
      * @return JsonResponse
45 45
      */
46
-    public function saveQuestions(Request $request): JsonResponse
47
-    {
48
-        if (UserFacade::getUser()->getChocolateyId()->password != hash(Config::get('chocolatey.security.hash'), $request->json()->get('password'))) {
49
-            return response()->json(['error' => 'invalid_password'], 400);
50
-        }
51
-
52
-        UserSecurity::updateOrCreate([
53
-            'user_id'        => UserFacade::getUser()->uniqueId,
54
-            'firstQuestion'  => $request->json()->get('questionId1'),
55
-            'secondQuestion' => $request->json()->get('questionId2'),
56
-            'firstAnswer'    => $request->json()->get('answer1'),
57
-            'secondAnswer'   => $request->json()->get('answer2'), ]);
58
-
59
-        return response()->json(null, 204);
60
-    }
61
-
62
-    /**
46
+     public function saveQuestions(Request $request): JsonResponse
47
+     {
48
+         if (UserFacade::getUser()->getChocolateyId()->password != hash(Config::get('chocolatey.security.hash'), $request->json()->get('password'))) {
49
+             return response()->json(['error' => 'invalid_password'], 400);
50
+         }
51
+
52
+         UserSecurity::updateOrCreate([
53
+             'user_id'        => UserFacade::getUser()->uniqueId,
54
+             'firstQuestion'  => $request->json()->get('questionId1'),
55
+             'secondQuestion' => $request->json()->get('questionId2'),
56
+             'firstAnswer'    => $request->json()->get('answer1'),
57
+             'secondAnswer'   => $request->json()->get('answer2'), ]);
58
+
59
+         return response()->json(null, 204);
60
+     }
61
+
62
+     /**
63 63
      * Disable Safety Lock.
64 64
      *
65 65
      * @return JsonResponse
66 66
      */
67
-    public function disable(): JsonResponse
68
-    {
69
-        UserSecurity::find(UserFacade::getUser()->uniqueId)->delete();
67
+     public function disable(): JsonResponse
68
+     {
69
+         UserSecurity::find(UserFacade::getUser()->uniqueId)->delete();
70 70
 
71
-        return response()->json(null, 204);
72
-    }
71
+         return response()->json(null, 204);
72
+     }
73 73
 
74
-    /**
74
+     /**
75 75
      * Reset Trusted Devices.
76 76
      *
77 77
      * @return JsonResponse
78 78
      */
79
-    public function reset(): JsonResponse
80
-    {
81
-        TrustedDevice::find(UserFacade::getUser()->uniqueId)->delete();
79
+     public function reset(): JsonResponse
80
+     {
81
+         TrustedDevice::find(UserFacade::getUser()->uniqueId)->delete();
82 82
 
83
-        return response()->json(null, 204);
84
-    }
83
+         return response()->json(null, 204);
84
+     }
85 85
 
86
-    /**
86
+     /**
87 87
      * Change User Password.
88 88
      *
89 89
      * @TODO: Implement Notification E-mail of Password change
@@ -92,139 +92,139 @@  discard block
 block discarded – undo
92 92
      *
93 93
      * @return JsonResponse
94 94
      */
95
-    public function changePassword(Request $request): JsonResponse
96
-    {
97
-        UserFacade::getUser()->getChocolateyId()->update(['password' => hash(Config::get('chocolatey.security.hash'),
98
-            $request->json()->get('password'))]);
95
+     public function changePassword(Request $request): JsonResponse
96
+     {
97
+         UserFacade::getUser()->getChocolateyId()->update(['password' => hash(Config::get('chocolatey.security.hash'),
98
+             $request->json()->get('password'))]);
99 99
 
100
-        return response()->json(null, 204);
101
-    }
100
+         return response()->json(null, 204);
101
+     }
102 102
 
103
-    /**
103
+     /**
104 104
      * Confirm E-Mail Activation.
105 105
      *
106 106
      * @param Request $request
107 107
      *
108 108
      * @return JsonResponse
109 109
      */
110
-    public function confirmActivation(Request $request): JsonResponse
111
-    {
112
-        if (Mail::get($request->json()->get('token')) == null) {
113
-            return response()->json(['error' => 'activation.invalid_token'], 400);
114
-        }
110
+     public function confirmActivation(Request $request): JsonResponse
111
+     {
112
+         if (Mail::get($request->json()->get('token')) == null) {
113
+             return response()->json(['error' => 'activation.invalid_token'], 400);
114
+         }
115 115
 
116
-        ChocolateyId::find(Mail::get()->mail)->update(['mail_verified' => '1']);
116
+         ChocolateyId::find(Mail::get()->mail)->update(['mail_verified' => '1']);
117 117
 
118
-        if (strpos(Mail::get()->link, 'change-email') !== false) {
119
-            $email = str_replace('change-email/', '', Mail::get()->link);
118
+         if (strpos(Mail::get()->link, 'change-email') !== false) {
119
+             $email = str_replace('change-email/', '', Mail::get()->link);
120 120
 
121
-            User::where('mail', Mail::get()->mail)->update(['mail' => $email]);
121
+             User::where('mail', Mail::get()->mail)->update(['mail' => $email]);
122 122
 
123
-            ChocolateyId::find(Mail::get()->mail)->update(['mail' => $email]);
124
-        }
123
+             ChocolateyId::find(Mail::get()->mail)->update(['mail' => $email]);
124
+         }
125 125
 
126
-        return response()->json(['email' => Mail::get()->mail, 'emailVerified' => true, 'identityVerified' => true]);
127
-    }
126
+         return response()->json(['email' => Mail::get()->mail, 'emailVerified' => true, 'identityVerified' => true]);
127
+     }
128 128
 
129
-    /**
129
+     /**
130 130
      * Change User E-mail.
131 131
      *
132 132
      * @param Request $request
133 133
      *
134 134
      * @return JsonResponse
135 135
      */
136
-    public function changeMail(Request $request): JsonResponse
137
-    {
138
-        if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('currentPassword')))->count() == 0) {
139
-            return response()->json(['error' => 'changeEmail.invalid_password'], 400);
140
-        }
136
+     public function changeMail(Request $request): JsonResponse
137
+     {
138
+         if (User::where('password', hash(Config::get('chocolatey.security.hash'), $request->json()->get('currentPassword')))->count() == 0) {
139
+             return response()->json(['error' => 'changeEmail.invalid_password'], 400);
140
+         }
141 141
 
142
-        if (ChocolateyId::where('mail', $request->json()->get('newEmail'))->count() > 0) {
143
-            return response()->json(['error' => 'changeEmail.email_already_in_use'], 400);
144
-        }
142
+         if (ChocolateyId::where('mail', $request->json()->get('newEmail'))->count() > 0) {
143
+             return response()->json(['error' => 'changeEmail.email_already_in_use'], 400);
144
+         }
145 145
 
146
-        $this->sendChangeMailConfirmation($request);
146
+         $this->sendChangeMailConfirmation($request);
147 147
 
148
-        return response()->json(['email' => $request->json()->get('newEmail')], 200);
149
-    }
148
+         return response()->json(['email' => $request->json()->get('newEmail')], 200);
149
+     }
150 150
 
151
-    /**
151
+     /**
152 152
      * Send the E-Mail confirmation.
153 153
      *
154 154
      * @param Request $request
155 155
      */
156
-    protected function sendChangeMailConfirmation(Request $request)
157
-    {
158
-        Mail::send(['email' => UserFacade::getUser()->email,
159
-            'name'          => UserFacade::getUser()->name, 'subject' => 'Email change alert',
160
-        ], 'habbo-web-mail.mail-change-alert');
156
+     protected function sendChangeMailConfirmation(Request $request)
157
+     {
158
+         Mail::send(['email' => UserFacade::getUser()->email,
159
+             'name'          => UserFacade::getUser()->name, 'subject' => 'Email change alert',
160
+         ], 'habbo-web-mail.mail-change-alert');
161 161
 
162
-        $generatedToken = Mail::store(UserFacade::getUser()->email,
163
-            "change-email/{$request->json()->get('newEmail')}");
162
+         $generatedToken = Mail::store(UserFacade::getUser()->email,
163
+             "change-email/{$request->json()->get('newEmail')}");
164 164
 
165
-        Mail::send(['email' => $request->json()->get('newEmail'), 'name' => UserFacade::getUser()->name,
166
-            'subject'       => 'Email change confirmation', 'url' => "/activate/{$generatedToken}",
167
-        ], 'habbo-web-mail.confirm-mail-change');
168
-    }
165
+         Mail::send(['email' => $request->json()->get('newEmail'), 'name' => UserFacade::getUser()->name,
166
+             'subject'       => 'Email change confirmation', 'url' => "/activate/{$generatedToken}",
167
+         ], 'habbo-web-mail.confirm-mail-change');
168
+     }
169 169
 
170
-    /**
170
+     /**
171 171
      * Get User Security Questions.
172 172
      *
173 173
      * @return JsonResponse
174 174
      */
175
-    public function getQuestions(): JsonResponse
176
-    {
177
-        if (UserSecurity::find(UserFacade::getUser()->uniqueId) == null) {
178
-            return response()->json('');
179
-        }
180
-
181
-        $userSecurity = UserSecurity::find(UserFacade::getUser()->uniqueId);
182
-
183
-        return response()->json([
184
-            new Question($userSecurity->firstQuestion,
185
-                "IDENTITY_SAFETYQUESTION_{$userSecurity->firstQuestion}"),
186
-            new Question($userSecurity->secondQuestion,
187
-                "IDENTITY_SAFETYQUESTION_{$userSecurity->secondQuestion}"),
188
-        ]);
189
-    }
190
-
191
-    /**
175
+     public function getQuestions(): JsonResponse
176
+     {
177
+         if (UserSecurity::find(UserFacade::getUser()->uniqueId) == null) {
178
+             return response()->json('');
179
+         }
180
+
181
+         $userSecurity = UserSecurity::find(UserFacade::getUser()->uniqueId);
182
+
183
+         return response()->json([
184
+             new Question($userSecurity->firstQuestion,
185
+                 "IDENTITY_SAFETYQUESTION_{$userSecurity->firstQuestion}"),
186
+             new Question($userSecurity->secondQuestion,
187
+                 "IDENTITY_SAFETYQUESTION_{$userSecurity->secondQuestion}"),
188
+         ]);
189
+     }
190
+
191
+     /**
192 192
      * Verify User Security Questions.
193 193
      *
194 194
      * @param Request $request
195 195
      *
196 196
      * @return JsonResponse
197 197
      */
198
-    public function verifyQuestions(Request $request): JsonResponse
199
-    {
200
-        $questions = UserSecurity::find(UserFacade::getUser()->uniqueId);
198
+     public function verifyQuestions(Request $request): JsonResponse
199
+     {
200
+         $questions = UserSecurity::find(UserFacade::getUser()->uniqueId);
201 201
 
202
-        if ($questions->firstAnswer == $request->json()->get('answer1') && $questions->secondAnswer == $request->json()->get('answer2')) {
203
-            if ($request->json()->get('trust') == true) {
204
-                (new TrustedDevice())->store(UserFacade::getUser()->uniqueId, $request->ip());
205
-            }
202
+         if ($questions->firstAnswer == $request->json()->get('answer1') && $questions->secondAnswer == $request->json()->get('answer2')) {
203
+             if ($request->json()->get('trust') == true) {
204
+                 (new TrustedDevice())->store(UserFacade::getUser()->uniqueId, $request->ip());
205
+             }
206 206
 
207
-            return response()->json(null, 204);
208
-        }
207
+             return response()->json(null, 204);
208
+         }
209 209
 
210
-        return response()->json(null, 409);
211
-    }
210
+         return response()->json(null, 409);
211
+     }
212 212
 
213
-    /**
213
+     /**
214 214
      * Confirm User Change Password.
215 215
      *
216 216
      * @param Request $request
217 217
      *
218 218
      * @return mixed
219 219
      */
220
-    public function confirmChangePassword(Request $request): JsonResponse
221
-    {
222
-        if (Mail::get($request->json()->get('token')) == null) {
223
-            return response()->json(null, 404);
224
-        }
220
+     public function confirmChangePassword(Request $request): JsonResponse
221
+     {
222
+         if (Mail::get($request->json()->get('token')) == null) {
223
+             return response()->json(null, 404);
224
+         }
225 225
 
226
-        ChocolateyId::find(Mail::get()->mail)->update(['password' => hash(Config::get('chocolatey.security.hash'), $request->json()->get('password'))]);
226
+         ChocolateyId::find(Mail::get()->mail)->update(['password' => hash(Config::get('chocolatey.security.hash'), $request->json()->get('password'))]);
227 227
 
228
-        return response()->json(null);
229
-    }
228
+         return response()->json(null);
229
+     }
230 230
 }
Please login to merge, or discard this patch.
app/Models/FlatCat.php 1 patch
Switch Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Models;
3
+ namespace App\Models;
4 4
 
5 5
 /**
6 6
  * Class FlatCat.
7 7
  */
8
-class FlatCat extends ChocolateyModel
9
-{
10
-    /**
8
+ class FlatCat extends ChocolateyModel
9
+ {
10
+     /**
11 11
      * Disable Timestamps.
12 12
      *
13 13
      * @var bool
14 14
      */
15
-    public $timestamps = false;
15
+     public $timestamps = false;
16 16
 
17
-    /**
17
+     /**
18 18
      * The table associated with the model.
19 19
      *
20 20
      * @var string
21 21
      */
22
-    protected $table = 'navigator_flatcats';
22
+     protected $table = 'navigator_flatcats';
23 23
 
24
-    /**
24
+     /**
25 25
      * Primary Key of the Table.
26 26
      *
27 27
      * @var string
28 28
      */
29
-    protected $primaryKey = 'id';
29
+     protected $primaryKey = 'id';
30 30
 }
Please login to merge, or discard this patch.
app/Models/ShopInventory.php 1 patch
Switch Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,85 +1,85 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Models;
3
+ namespace App\Models;
4 4
 
5 5
 /**
6 6
  * Class ShopInventory.
7 7
  */
8
-class ShopInventory
9
-{
10
-    /**
8
+ class ShopInventory
9
+ {
10
+     /**
11 11
      * Payment Categories of the Country.
12 12
      *
13 13
      * @var PaymentCategory[]
14 14
      */
15
-    public $paymentCategories = [];
15
+     public $paymentCategories = [];
16 16
 
17
-    /**
17
+     /**
18 18
      * Inventory Items.
19 19
      *
20 20
      * @var array
21 21
      */
22
-    public $pricePoints = [];
22
+     public $pricePoints = [];
23 23
 
24
-    /**
24
+     /**
25 25
      * If double Credits are Enabled.
26 26
      *
27 27
      * @var bool
28 28
      */
29
-    public $doubleCredits = false;
29
+     public $doubleCredits = false;
30 30
 
31
-    /**
31
+     /**
32 32
      * Country Meta Data.
33 33
      *
34 34
      * @var Country
35 35
      */
36
-    public $country = null;
36
+     public $country = null;
37 37
 
38
-    /**
38
+     /**
39 39
      * Create a Shop Inventory.
40 40
      *
41 41
      * @param Country $country
42 42
      */
43
-    public function __construct(Country $country)
44
-    {
45
-        $this->setCountry($country);
46
-        $this->setPaymentCategories($country->countryCode);
47
-        $this->setPricePoints($country->countryCode);
48
-    }
43
+     public function __construct(Country $country)
44
+     {
45
+         $this->setCountry($country);
46
+         $this->setPaymentCategories($country->countryCode);
47
+         $this->setPricePoints($country->countryCode);
48
+     }
49 49
 
50
-    /**
50
+     /**
51 51
      * Set the Country Metadata.
52 52
      *
53 53
      * @param Country $country
54 54
      */
55
-    public function setCountry(Country $country)
56
-    {
57
-        $this->country = $country;
58
-    }
55
+     public function setCountry(Country $country)
56
+     {
57
+         $this->country = $country;
58
+     }
59 59
 
60
-    /**
60
+     /**
61 61
      * Set the Payment Methods.
62 62
      *
63 63
      * @param string $countryCode
64 64
      */
65
-    public function setPaymentCategories(string $countryCode)
66
-    {
67
-        $paymentMethods = [];
65
+     public function setPaymentCategories(string $countryCode)
66
+     {
67
+         $paymentMethods = [];
68 68
 
69
-        foreach (PaymentCategory::where('country_code', $countryCode)->get(['payment_type']) as $paymentMethod) {
70
-            $paymentMethods[] = $paymentMethod->payment_type;
71
-        }
69
+         foreach (PaymentCategory::where('country_code', $countryCode)->get(['payment_type']) as $paymentMethod) {
70
+             $paymentMethods[] = $paymentMethod->payment_type;
71
+         }
72 72
 
73
-        $this->paymentCategories = $paymentMethods;
74
-    }
73
+         $this->paymentCategories = $paymentMethods;
74
+     }
75 75
 
76
-    /**
76
+     /**
77 77
      * Get All Shop Items from this Country Code.
78 78
      *
79 79
      * @param string $countryCode
80 80
      */
81
-    public function setPricePoints(string $countryCode)
82
-    {
83
-        $this->pricePoints = ShopItem::where('countryCode', $countryCode)->get();
84
-    }
81
+     public function setPricePoints(string $countryCode)
82
+     {
83
+         $this->pricePoints = ShopItem::where('countryCode', $countryCode)->get();
84
+     }
85 85
 }
Please login to merge, or discard this patch.
app/Models/UserProfile.php 1 patch
Switch Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -1,109 +1,109 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Models;
3
+ namespace App\Models;
4 4
 
5 5
 /**
6 6
  * Class UserProfile.
7 7
  */
8
-class UserProfile
9
-{
10
-    /**
8
+ class UserProfile
9
+ {
10
+     /**
11 11
      * User Data.
12 12
      *
13 13
      * @var User
14 14
      */
15
-    public $user;
15
+     public $user;
16 16
 
17
-    /**
17
+     /**
18 18
      * User Friends.
19 19
      *
20 20
      * @var UserFriend[]|array
21 21
      */
22
-    public $friends = [];
22
+     public $friends = [];
23 23
 
24
-    /**
24
+     /**
25 25
      * User Badges.
26 26
      *
27 27
      * @var UserBadge[]|array
28 28
      */
29
-    public $badges = [];
29
+     public $badges = [];
30 30
 
31
-    /**
31
+     /**
32 32
      * User Groups.
33 33
      *
34 34
      * @var UserGroup[]|array
35 35
      */
36
-    public $groups = [];
36
+     public $groups = [];
37 37
 
38
-    /**
38
+     /**
39 39
      * User Rooms.
40 40
      *
41 41
      * @var Room[]|array
42 42
      */
43
-    public $rooms = [];
43
+     public $rooms = [];
44 44
 
45
-    /**
45
+     /**
46 46
      * UserProfile constructor.
47 47
      *
48 48
      * @param User $userData
49 49
      *
50 50
      * @return UserProfile
51 51
      */
52
-    public function __construct(User $userData)
53
-    {
54
-        $this->setUser($userData);
52
+     public function __construct(User $userData)
53
+     {
54
+         $this->setUser($userData);
55 55
 
56
-        $this->setFriends();
57
-        $this->setBadges();
58
-        $this->setGroups();
59
-        $this->setRooms();
56
+         $this->setFriends();
57
+         $this->setBadges();
58
+         $this->setGroups();
59
+         $this->setRooms();
60 60
 
61
-        return $this;
62
-    }
61
+         return $this;
62
+     }
63 63
 
64
-    /**
64
+     /**
65 65
      * Set User Data.
66 66
      *
67 67
      * @param User $userData
68 68
      */
69
-    protected function setUser(User $userData)
70
-    {
71
-        $this->user = $userData;
72
-    }
69
+     protected function setUser(User $userData)
70
+     {
71
+         $this->user = $userData;
72
+     }
73 73
 
74
-    /**
74
+     /**
75 75
      * Set User Friends.
76 76
      */
77
-    protected function setFriends()
78
-    {
79
-        $this->friends = UserFriend::where('user_one_id', $this->user->uniqueId)->get() ?? [];
80
-    }
77
+     protected function setFriends()
78
+     {
79
+         $this->friends = UserFriend::where('user_one_id', $this->user->uniqueId)->get() ?? [];
80
+     }
81 81
 
82
-    /**
82
+     /**
83 83
      * Set User Badges.
84 84
      */
85
-    protected function setBadges()
86
-    {
87
-        $this->badges = UserBadge::where('user_id', $this->user->uniqueId)->get() ?? [];
88
-    }
85
+     protected function setBadges()
86
+     {
87
+         $this->badges = UserBadge::where('user_id', $this->user->uniqueId)->get() ?? [];
88
+     }
89 89
 
90
-    /**
90
+     /**
91 91
      * Set User Groups.
92 92
      */
93
-    protected function setGroups()
94
-    {
95
-        $groups = GroupMember::where('user_id', $this->user->uniqueId)->get() ?? [];
93
+     protected function setGroups()
94
+     {
95
+         $groups = GroupMember::where('user_id', $this->user->uniqueId)->get() ?? [];
96 96
 
97
-        foreach ($groups as $group) {
98
-            $this->groups[] = $group->guild;
99
-        }
100
-    }
97
+         foreach ($groups as $group) {
98
+             $this->groups[] = $group->guild;
99
+         }
100
+     }
101 101
 
102
-    /**
102
+     /**
103 103
      * Set User Rooms.
104 104
      */
105
-    public function setRooms()
106
-    {
107
-        $this->rooms = Room::where('owner_id', $this->user->uniqueId)->where('state', '!=', 'invisible')->get() ?? [];
108
-    }
105
+     public function setRooms()
106
+     {
107
+         $this->rooms = Room::where('owner_id', $this->user->uniqueId)->where('state', '!=', 'invisible')->get() ?? [];
108
+     }
109 109
 }
Please login to merge, or discard this patch.
app/Models/Purse.php 1 patch
Switch Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,61 +1,61 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Models;
3
+ namespace App\Models;
4 4
 
5 5
 /**
6 6
  * Class Purse.
7 7
  */
8
-class Purse
9
-{
10
-    /**
8
+ class Purse
9
+ {
10
+     /**
11 11
      * User Credits Balance.
12 12
      *
13 13
      * @var int
14 14
      */
15
-    public $creditBalance = 0;
15
+     public $creditBalance = 0;
16 16
 
17
-    /**
17
+     /**
18 18
      * User Builders Club Furniture Limit.
19 19
      *
20 20
      * @var int
21 21
      */
22
-    public $buildersClubFurniLimit = 0;
22
+     public $buildersClubFurniLimit = 0;
23 23
 
24
-    /**
24
+     /**
25 25
      * Remaining Builders Club Days.
26 26
      *
27 27
      * @var int
28 28
      */
29
-    public $buildersClubDays = 0;
29
+     public $buildersClubDays = 0;
30 30
 
31
-    /**
31
+     /**
32 32
      * User Habbo Club Days.
33 33
      *
34 34
      * @var int
35 35
      */
36
-    public $habboClubDays = 0;
36
+     public $habboClubDays = 0;
37 37
 
38
-    /**
38
+     /**
39 39
      * User Diamond Balance.
40 40
      *
41 41
      * @var int
42 42
      */
43
-    public $diamondBalance = 0;
43
+     public $diamondBalance = 0;
44 44
 
45
-    /**
45
+     /**
46 46
      * Create an User Purse.
47 47
      *
48 48
      * @TODO: Get User Left Habbo Club Days
49 49
      *
50 50
      * @param int $userId
51 51
      */
52
-    public function __construct(int $userId)
53
-    {
54
-        $userDiamonds = UserCurrency::where('user_id', $userId)->where('type', 5)->first();
55
-        $habboDays = floor(((UserSettings::where('user_id', $userId)->first()->club_expire_timestamp ?? 0) - time()) / 86400);
56
-
57
-        $this->creditBalance = User::find($userId)->credits;
58
-        $this->diamondBalance = $userDiamonds->amount ?? 0;
59
-        $this->habboClubDays = $habboDays > 0 ? $habboDays : 0;
60
-    }
52
+     public function __construct(int $userId)
53
+     {
54
+         $userDiamonds = UserCurrency::where('user_id', $userId)->where('type', 5)->first();
55
+         $habboDays = floor(((UserSettings::where('user_id', $userId)->first()->club_expire_timestamp ?? 0) - time()) / 86400);
56
+
57
+         $this->creditBalance = User::find($userId)->credits;
58
+         $this->diamondBalance = $userDiamonds->amount ?? 0;
59
+         $this->habboClubDays = $habboDays > 0 ? $habboDays : 0;
60
+     }
61 61
 }
Please login to merge, or discard this patch.
app/Models/Question.php 1 patch
Switch Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,35 +1,35 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Models;
3
+ namespace App\Models;
4 4
 
5 5
 /**
6 6
  * Class Question.
7 7
  */
8
-class Question
9
-{
10
-    /**
8
+ class Question
9
+ {
10
+     /**
11 11
      * Question Identifier (One or Two).
12 12
      *
13 13
      * @var int
14 14
      */
15
-    public $questionId = 1;
15
+     public $questionId = 1;
16 16
 
17
-    /**
17
+     /**
18 18
      * Question Key (Translate Text).
19 19
      *
20 20
      * @var string
21 21
      */
22
-    public $questionKey = '';
22
+     public $questionKey = '';
23 23
 
24
-    /**
24
+     /**
25 25
      * Store a Question.
26 26
      *
27 27
      * @param int    $questionId
28 28
      * @param string $questionKey
29 29
      */
30
-    public function __construct(int $questionId, string $questionKey)
31
-    {
32
-        $this->questionId = $questionId;
33
-        $this->questionKey = $questionKey;
34
-    }
30
+     public function __construct(int $questionId, string $questionKey)
31
+     {
32
+         $this->questionId = $questionId;
33
+         $this->questionKey = $questionKey;
34
+     }
35 35
 }
Please login to merge, or discard this patch.
app/Http/Controllers/LanguageController.php 1 patch
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Http\Controllers;
3
+ namespace App\Http\Controllers;
4 4
 
5
-use Illuminate\Http\Response;
6
-use Laravel\Lumen\Routing\Controller as BaseController;
5
+ use Illuminate\Http\Response;
6
+ use Laravel\Lumen\Routing\Controller as BaseController;
7 7
 
8 8
 /**
9 9
  * Class LanguageController.
10 10
  */
11
-class LanguageController extends BaseController
12
-{
13
-    /**
11
+ class LanguageController extends BaseController
12
+ {
13
+     /**
14 14
      * Render Language View (jSON).
15 15
      *
16 16
      * @param $languageFile
17 17
      *
18 18
      * @return Response
19 19
      */
20
-    public function render($languageFile): Response
21
-    {
22
-        $languageName = strstr($languageFile, '.json', true);
20
+     public function render($languageFile): Response
21
+     {
22
+         $languageName = strstr($languageFile, '.json', true);
23 23
 
24
-        return response(view("habbo-web-l10n.{$languageName}"))->header('Content-Type', 'application/json');
25
-    }
24
+         return response(view("habbo-web-l10n.{$languageName}"))->header('Content-Type', 'application/json');
25
+     }
26 26
 }
Please login to merge, or discard this patch.
app/Http/Controllers/ImagingController.php 1 patch
Switch Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Http\Controllers;
3
+ namespace App\Http\Controllers;
4 4
 
5
-use App\Models\EmulatorSettings;
6
-use App\Models\User;
7
-use Illuminate\Http\Request;
8
-use Illuminate\Support\Facades\Config;
9
-use Intervention\Image\Facades\Image;
10
-use Laravel\Lumen\Http\Redirector;
11
-use Laravel\Lumen\Routing\Controller as BaseController;
5
+ use App\Models\EmulatorSettings;
6
+ use App\Models\User;
7
+ use Illuminate\Http\Request;
8
+ use Illuminate\Support\Facades\Config;
9
+ use Intervention\Image\Facades\Image;
10
+ use Laravel\Lumen\Http\Redirector;
11
+ use Laravel\Lumen\Routing\Controller as BaseController;
12 12
 
13 13
 /**
14 14
  * Class ImagingController.
15 15
  */
16
-class ImagingController extends BaseController
17
-{
18
-    /**
16
+ class ImagingController extends BaseController
17
+ {
18
+     /**
19 19
      * Get User Figure for Big Header
20 20
      * based on User Name or Figure.
21 21
      *
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
      *
24 24
      * @return Redirector
25 25
      */
26
-    public function getUserHead(Request $request)
27
-    {
28
-        return redirect(Config::get('chocolatey.imaging').'avatarimage?figure='.($request->has('figure') ? $request->input('figure') :
29
-                User::where('username', $request->input('user'))->first()->figureString).'&size=l&headonly=1');
30
-    }
26
+     public function getUserHead(Request $request)
27
+     {
28
+         return redirect(Config::get('chocolatey.imaging').'avatarimage?figure='.($request->has('figure') ? $request->input('figure') :
29
+                 User::where('username', $request->input('user'))->first()->figureString).'&size=l&headonly=1');
30
+     }
31 31
 
32
-    /**
32
+     /**
33 33
      * Get User Figure for Body
34 34
      * based on User Figure.
35 35
      *
@@ -37,36 +37,36 @@  discard block
 block discarded – undo
37 37
      *
38 38
      * @return Redirector
39 39
      */
40
-    public function getUserBody(string $figure)
41
-    {
42
-        return redirect(Config::get('chocolatey.imaging')."avatar/{$figure}");
43
-    }
40
+     public function getUserBody(string $figure)
41
+     {
42
+         return redirect(Config::get('chocolatey.imaging')."avatar/{$figure}");
43
+     }
44 44
 
45
-    /**
45
+     /**
46 46
      * Get Youtube Thumbnail.
47 47
      *
48 48
      * @param Request $request
49 49
      *
50 50
      * @return string
51 51
      */
52
-    public function getYoutubeThumbnail(Request $request)
53
-    {
54
-        return Image::make($request->input('url'))->response('jpg');
55
-    }
52
+     public function getYoutubeThumbnail(Request $request)
53
+     {
54
+         return Image::make($request->input('url'))->response('jpg');
55
+     }
56 56
 
57
-    /**
57
+     /**
58 58
      * Return Group Badge.
59 59
      *
60 60
      * @param string $badgeCode
61 61
      *
62 62
      * @return mixed
63 63
      */
64
-    public function getGroupBadge(string $badgeCode)
65
-    {
66
-        $imagePath = EmulatorSettings::where('key', 'imager.location.output.badges')->first();
64
+     public function getGroupBadge(string $badgeCode)
65
+     {
66
+         $imagePath = EmulatorSettings::where('key', 'imager.location.output.badges')->first();
67 67
 
68
-        $badgeCode = str_replace('.gif', '', $badgeCode);
68
+         $badgeCode = str_replace('.gif', '', $badgeCode);
69 69
 
70
-        return Image::make("{$imagePath->value}/{$badgeCode}.png")->response('gif');
71
-    }
70
+         return Image::make("{$imagePath->value}/{$badgeCode}.png")->response('gif');
71
+     }
72 72
 }
Please login to merge, or discard this patch.
app/Http/Middleware/Maintenance.php 1 patch
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  discard block
 block discarded – undo
1
-<?php
1
+ <?php
2 2
 
3
-namespace App\Http\Middleware;
3
+ namespace App\Http\Middleware;
4 4
 
5
-use Closure;
6
-use Illuminate\Http\Request;
7
-use Illuminate\Support\Facades\Config;
5
+ use Closure;
6
+ use Illuminate\Http\Request;
7
+ use Illuminate\Support\Facades\Config;
8 8
 
9 9
 /**
10 10
  * Class Maintenance.
11 11
  */
12
-class Maintenance
13
-{
14
-    /**
12
+ class Maintenance
13
+ {
14
+     /**
15 15
      * Handle an incoming request.
16 16
      *
17 17
      * @param Request $request
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
      *
20 20
      * @return mixed
21 21
      */
22
-    public function handle($request, Closure $next)
23
-    {
24
-        return Config::get('maintenance.enforce') ? response()->json(['error' => 'maintenance'], 503) :
25
-            $next($request);
26
-    }
22
+     public function handle($request, Closure $next)
23
+     {
24
+         return Config::get('maintenance.enforce') ? response()->json(['error' => 'maintenance'], 503) :
25
+             $next($request);
26
+     }
27 27
 }
Please login to merge, or discard this patch.