Completed
Push — master ( 80de42...cbe5cc )
by Abdelrahman
05:30
created

AuthyServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
            return new AuthyApp($httpClient, $key);
36
        });
37
38
        $this->app->singleton('rinvex.authy.user', function ($app) use ($httpClient, $key) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
            return new AuthyUser($httpClient, $key);
40
        });
41
42
        $this->app->singleton('rinvex.authy.token', function ($app) use ($httpClient, $key) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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