ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 21
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 13
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 21
ccs 13
cts 13
cp 1
crap 2
rs 9.8333
1
<?php
2
3
namespace FMCSSOClient;
4
5
class ServiceProvider extends \Illuminate\Support\ServiceProvider
6
{
7
8
    /**
9
     * Register any application authentication / authorization services.
10
     *
11
     * @return void
12
     */
13 24
    public function boot()
14
    {
15 24
        if ($this->app->runningInConsole()) {
16 24
            $this->publishes([
17 24
                __DIR__ . '/../config/fmc-sso-client.php' => config_path('fmc-sso-client.php'),
18
            ], 'config');
19
20
21 24
            $this->commands([
22
                //
23
            ]);
24
        }
25
26 24
        $this->app->singleton(SSOClient::class, function () {
27 23
            return new SSOClient(
28 23
                config('services.fmc-sso.client_id', config('fmc-sso-client.client_id')),
29 23
                config('services.fmc-sso.client_secret', config('fmc-sso-client.client_secret')),
30 23
                config('services.fmc-sso.redirect_url', config('fmc-sso-client.redirect_url')),
31 23
                config('services.fmc-sso.scopes', config('fmc-sso-client.scopes')),
32 23
                config('services.fmc-sso.sso', config('fmc-sso-client.sso', [])),
33 23
                config('services.fmc-sso.guzzle', config('fmc-sso-client.guzzle', [])),
34
            );
35
        });
36
    }
37
38 24
    public function register()
39
    {
40 24
        $this->mergeConfigFrom(__DIR__ . '/../config/fmc-sso-client.php', 'fmc-sso-client');
41
    }
42
}
43