Completed
Pull Request — master (#2)
by ARCANEDEV
03:23
created

AgentServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 56
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 11 1
A boot() 0 6 1
A provides() 0 6 1
1
<?php namespace Arcanedev\Agent;
2
3
use Arcanedev\Support\PackageServiceProvider;
4
5
/**
6
 * Class     AgentServiceProvider
7
 *
8
 * @package  Arcanedev\Agent
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class AgentServiceProvider extends PackageServiceProvider
12
{
13
    /* -----------------------------------------------------------------
14
     |  Properties
15
     | -----------------------------------------------------------------
16
     */
17
18
    /**
19
     * Package name.
20
     *
21
     * @var string
22
     */
23
    protected $package = 'agent';
24
25
    /* -----------------------------------------------------------------
26
     |  Main Methods
27
     | -----------------------------------------------------------------
28
     */
29
30
    /**
31
     * Register the service provider.
32
     */
33 105
    public function register()
34
    {
35 105
        parent::register();
36
37 105
        $this->singleton(Contracts\Agent::class, function ($app) {
38
            /** @var  \Illuminate\Http\Request  $request */
39 99
            $request = $app['request'];
40
41 99
            return new Agent($request->server->all());
42 105
        });
43 105
    }
44
45
    /**
46
     * Boot the service provider.
47
     */
48 105
    public function boot()
49
    {
50 105
        parent::boot();
51
52
        //
53 105
    }
54
55
    /**
56
     * Get the services provided by the provider.
57
     *
58
     * @return array
59
     */
60 3
    public function provides()
61
    {
62
        return [
63 3
            Contracts\Agent::class,
64 1
        ];
65
    }
66
}
67