7
7
*/
8
8
namespace UserFrosting \Sprinkle \Account \ServicesProvider ;
9
9
10
- use Birke \Rememberme \Authenticator as RememberMe ;
11
10
use Illuminate \Database \Capsule \Manager as Capsule ;
12
- use Monolog \Formatter \LineFormatter ;
13
- use Monolog \Handler \ErrorLogHandler ;
11
+ use Interop \Container \ContainerInterface ;
14
12
use Monolog \Handler \StreamHandler ;
15
13
use Monolog \Logger ;
16
14
use Psr \Http \Message \ResponseInterface as Response ;
25
23
use UserFrosting \Sprinkle \Account \Repository \PasswordResetRepository ;
26
24
use UserFrosting \Sprinkle \Account \Repository \VerificationRepository ;
27
25
use UserFrosting \Sprinkle \Account \Twig \AccountExtension ;
28
- use UserFrosting \Sprinkle \Core \Facades \Debug ;
29
26
use UserFrosting \Sprinkle \Core \Log \MixedFormatter ;
30
27
31
28
/**
@@ -38,12 +35,14 @@ class ServicesProvider
38
35
/**
39
36
* Register UserFrosting's account services.
40
37
*
41
- * @param Container $container A DI container implementing ArrayAccess and container-interop.
38
+ * @param ContainerInterface $container A DI container implementing ArrayAccess and container-interop.
42
39
*/
43
- public function register ($ container )
40
+ public function register (ContainerInterface $ container )
44
41
{
45
42
/**
46
43
* Extend the asset manager service to see assets for the current user's theme.
44
+ *
45
+ * @return \UserFrosting\Assets\Assets
47
46
*/
48
47
$ container ->extend ('assets ' , function ($ assets , $ c ) {
49
48
@@ -68,6 +67,8 @@ public function register($container)
68
67
* Extend the 'classMapper' service to register model classes.
69
68
*
70
69
* Mappings added: User, Group, Role, Permission, Activity, PasswordReset, Verification
70
+ *
71
+ * @return \UserFrosting\Sprinkle\Core\Util\ClassMapper
71
72
*/
72
73
$ container ->extend ('classMapper ' , function ($ classMapper , $ c ) {
73
74
$ classMapper ->setClassMapping ('user ' , 'UserFrosting\Sprinkle\Account\Database\Models\User ' );
@@ -84,6 +85,8 @@ public function register($container)
84
85
* Extends the 'errorHandler' service with custom exception handlers.
85
86
*
86
87
* Custom handlers added: ForbiddenExceptionHandler
88
+ *
89
+ * @return \UserFrosting\Sprinkle\Core\Error\ExceptionHandlerManager
87
90
*/
88
91
$ container ->extend ('errorHandler ' , function ($ handler , $ c ) {
89
92
// Register the ForbiddenExceptionHandler.
@@ -98,6 +101,7 @@ public function register($container)
98
101
/**
99
102
* Extends the 'localePathBuilder' service, adding any locale files from the user theme.
100
103
*
104
+ * @return \UserFrosting\I18n\LocalePathBuilder
101
105
*/
102
106
$ container ->extend ('localePathBuilder ' , function ($ pathBuilder , $ c ) {
103
107
// Add paths for user theme, if a user is logged in
@@ -125,6 +129,8 @@ public function register($container)
125
129
* Extends the 'view' service with the AccountExtension for Twig.
126
130
*
127
131
* Adds account-specific functions, globals, filters, etc to Twig, and the path to templates for the user theme.
132
+ *
133
+ * @return \Slim\Views\Twig
128
134
*/
129
135
$ container ->extend ('view ' , function ($ view , $ c ) {
130
136
$ twig = $ view ->getEnvironment ();
@@ -159,6 +165,8 @@ public function register($container)
159
165
* Authentication service.
160
166
*
161
167
* Supports logging in users, remembering their sessions, etc.
168
+ *
169
+ * @return \UserFrosting\Sprinkle\Account\Authenticate\Authenticator
162
170
*/
163
171
$ container ['authenticator ' ] = function ($ c ) {
164
172
$ classMapper = $ c ->classMapper ;
@@ -178,6 +186,8 @@ public function register($container)
178
186
179
187
/**
180
188
* Sets up the AuthGuard middleware, used to limit access to authenticated users for certain routes.
189
+ *
190
+ * @return \UserFrosting\Sprinkle\Account\Authenticate\AuthGuard
181
191
*/
182
192
$ container ['authGuard ' ] = function ($ c ) {
183
193
$ authenticator = $ c ->authenticator ;
@@ -188,6 +198,8 @@ public function register($container)
188
198
* Authorization check logging with Monolog.
189
199
*
190
200
* Extend this service to push additional handlers onto the 'auth' log stack.
201
+ *
202
+ * @return \Monolog\Logger
191
203
*/
192
204
$ container ['authLogger ' ] = function ($ c ) {
193
205
$ logger = new Logger ('auth ' );
@@ -208,6 +220,8 @@ public function register($container)
208
220
* Authorization service.
209
221
*
210
222
* Determines permissions for user actions. Extend this service to add additional access condition callbacks.
223
+ *
224
+ * @return \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager
211
225
*/
212
226
$ container ['authorizer ' ] = function ($ c ) {
213
227
$ config = $ c ->config ;
@@ -327,20 +341,29 @@ public function register($container)
327
341
328
342
/**
329
343
* Loads the User object for the currently logged-in user.
344
+ *
345
+ * @return \UserFrosting\Sprinkle\Account\Database\Models\User
330
346
*/
331
347
$ container ['currentUser ' ] = function ($ c ) {
332
348
$ authenticator = $ c ->authenticator ;
333
349
334
350
return $ authenticator ->user ();
335
351
};
336
352
353
+ /**
354
+ * Password Hasher service
355
+ *
356
+ * @return \UserFrosting\Sprinkle\Account\Authenticate\Hasher
357
+ */
337
358
$ container ['passwordHasher ' ] = function ($ c ) {
338
359
$ hasher = new Hasher ();
339
360
return $ hasher ;
340
361
};
341
362
342
363
/**
343
364
* Returns a callback that forwards to dashboard if user is already logged in.
365
+ *
366
+ * @return callable
344
367
*/
345
368
$ container ['redirect.onAlreadyLoggedIn ' ] = function ($ c ) {
346
369
/**
@@ -361,6 +384,8 @@ public function register($container)
361
384
362
385
/**
363
386
* Returns a callback that handles setting the `UF-Redirect` header after a successful login.
387
+ *
388
+ * @return callable
364
389
*/
365
390
$ container ['redirect.onLogin ' ] = function ($ c ) {
366
391
/**
@@ -380,7 +405,7 @@ public function register($container)
380
405
return $ determineRedirectOnLogin ($ response )->withStatus (200 );
381
406
}
382
407
383
- /** @var UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager */
408
+ /** @var \ UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager */
384
409
$ authorizer = $ c ->authorizer ;
385
410
386
411
$ currentUser = $ c ->authenticator ->user ();
@@ -395,6 +420,8 @@ public function register($container)
395
420
396
421
/**
397
422
* Repository for password reset requests.
423
+ *
424
+ * @return \UserFrosting\Sprinkle\Account\Repository\PasswordResetRepository
398
425
*/
399
426
$ container ['repoPasswordReset ' ] = function ($ c ) {
400
427
$ classMapper = $ c ->classMapper ;
@@ -406,6 +433,8 @@ public function register($container)
406
433
407
434
/**
408
435
* Repository for verification requests.
436
+ *
437
+ * @return \UserFrosting\Sprinkle\Account\Repository\VerificationRepository
409
438
*/
410
439
$ container ['repoVerification ' ] = function ($ c ) {
411
440
$ classMapper = $ c ->classMapper ;
@@ -419,6 +448,8 @@ public function register($container)
419
448
* Logger for logging the current user's activities to the database.
420
449
*
421
450
* Extend this service to push additional handlers onto the 'userActivity' log stack.
451
+ *
452
+ * @return \Monolog\Logger
422
453
*/
423
454
$ container ['userActivityLogger ' ] = function ($ c ) {
424
455
$ classMapper = $ c ->classMapper ;
0 commit comments