ClientServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 46
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A register() 0 6 1
A registerAgent() 0 10 2
A registerClient() 0 8 1
1
<?php
2
3
namespace App\Support\Providers;
4
5
use App\Support\Client;
6
use Illuminate\Support\ServiceProvider;
7
use Jenssegers\Agent\Agent;
8
9
class ClientServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the service provider.
13
     */
14 1
    public function boot()
15
    {
16 1
        $this->app['view']->share('client', $this->app['client']);
17 1
    }
18
19
    /**
20
     * Register the service provider.
21
     */
22 1
    public function register()
23
    {
24 1
        $this->registerAgent();
25
26 1
        $this->registerClient();
27 1
    }
28
29
    /**
30
     * Register the Agent.
31
     */
32 1
    protected function registerAgent()
33
    {
34 1
        if (! $this->app->bound('agent')) {
35
            $this->app->singleton('agent', function () {
36 1
                return new Agent;
37 1
            });
38
39 1
            $this->app->alias('agent', Agent::class);
40
        }
41 1
    }
42
43
    /**
44
     * Register the Client.
45
     */
46
    protected function registerClient()
47
    {
48 1
        $this->app->singleton('client', function () {
49 1
            return new Client;
50 1
        });
51
52 1
        $this->app->alias('client', Client::class);
53 1
    }
54
}
55