1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* NOTICE OF LICENSE |
5
|
|
|
* |
6
|
|
|
* Part of the Rinvex Authy Package. |
7
|
|
|
* |
8
|
|
|
* This source file is subject to The MIT License (MIT) |
9
|
|
|
* that is bundled with this package in the LICENSE file. |
10
|
|
|
* |
11
|
|
|
* Package: Rinvex Authy Package |
12
|
|
|
* License: The MIT License (MIT) |
13
|
|
|
* Link: https://rinvex.com |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace Rinvex\Authy\Providers; |
17
|
|
|
|
18
|
|
|
use Rinvex\Authy\App as AuthyApp; |
19
|
|
|
use Rinvex\Authy\User as AuthyUser; |
20
|
|
|
use GuzzleHttp\Client as HttpClient; |
21
|
|
|
use Rinvex\Authy\Token as AuthyToken; |
22
|
|
|
use Illuminate\Support\ServiceProvider; |
23
|
|
|
|
24
|
|
|
class AuthyServiceProvider extends ServiceProvider |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* {@inheritdoc} |
28
|
|
|
*/ |
29
|
|
|
public function register() |
30
|
|
|
{ |
31
|
|
|
$httpClient = new HttpClient(); |
32
|
|
|
$key = config('services.authy.secret'); |
33
|
|
|
|
34
|
|
|
$this->app->singleton('rinvex.authy.app', function ($app) use ($httpClient, $key) { |
|
|
|
|
35
|
|
|
return new AuthyApp($httpClient, $key); |
36
|
|
|
}); |
37
|
|
|
|
38
|
|
|
$this->app->singleton('rinvex.authy.user', function ($app) use ($httpClient, $key) { |
|
|
|
|
39
|
|
|
return new AuthyUser($httpClient, $key); |
40
|
|
|
}); |
41
|
|
|
|
42
|
|
|
$this->app->singleton('rinvex.authy.token', function ($app) use ($httpClient, $key) { |
|
|
|
|
43
|
|
|
return new AuthyToken($httpClient, $key); |
44
|
|
|
}); |
45
|
|
|
|
46
|
|
|
$this->app->alias('rinvex.authy.app', AuthyApp::class); |
47
|
|
|
$this->app->alias('rinvex.authy.user', AuthyUser::class); |
48
|
|
|
$this->app->alias('rinvex.authy.token', AuthyToken::class); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.