LaravelCognitoServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 26
ccs 0
cts 13
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 5 1
A registerCognitoUserProvider() 0 4 1
A registerIssuer() 0 10 1
1
<?php declare(strict_types=1);
2
3
namespace CustomerGauge\Cognito;
4
5
use Illuminate\Container\Container;
6
use Illuminate\Support\Facades\Auth;
7
use Illuminate\Support\ServiceProvider;
8
9
final class LaravelCognitoServiceProvider extends ServiceProvider
10
{
11
    public function register()
12
    {
13
        $this->registerIssuer();
14
15
        $this->registerCognitoUserProvider();
16
    }
17
18
    private function registerIssuer(): void
19
    {
20
        $this->app->bind(Issuer::class, function () {
21
            $config = $this->app->get('config');
22
23
            $pool = $config->get('auth.cognito.pool');
24
25
            $region = $config->get('auth.cognito.region');
26
27
            return new Issuer($pool, $region);
28
        });
29
    }
30
31
    private function registerCognitoUserProvider(): void
32
    {
33
        Auth::provider(CognitoUserProvider::class, function (Container $app) {
34
            return $app->make(CognitoUserProvider::class);
35
        });
36
    }
37
}
38