AuthyServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 6
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 20 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Authy\Providers;
6
7
use Rinvex\Authy\App as AuthyApp;
8
use Rinvex\Authy\User as AuthyUser;
9
use GuzzleHttp\Client as HttpClient;
10
use Rinvex\Authy\Token as AuthyToken;
11
use Illuminate\Support\ServiceProvider;
12
13
class AuthyServiceProvider extends ServiceProvider
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function register()
19
    {
20
        $httpClient = new HttpClient();
21
        $key = config('services.authy.secret');
22
23
        $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...
24
            return new AuthyApp($httpClient, $key);
25
        });
26
        $this->app->alias('rinvex.authy.app', AuthyApp::class);
27
28
        $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...
29
            return new AuthyUser($httpClient, $key);
30
        });
31
        $this->app->alias('rinvex.authy.user', AuthyUser::class);
32
33
        $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...
34
            return new AuthyToken($httpClient, $key);
35
        });
36
        $this->app->alias('rinvex.authy.token', AuthyToken::class);
37
    }
38
}
39