SpamBlockerServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 1
A boot() 0 6 1
A provides() 0 6 1
A registerSpamBlocker() 0 11 1
1
<?php namespace Arcanedev\SpamBlocker;
2
3
use Arcanedev\Support\PackageServiceProvider as ServiceProvider;
4
5
/**
6
 * Class     SpamBlockerServiceProvider
7
 *
8
 * @package  Arcanedev\SpamBlocker
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class SpamBlockerServiceProvider extends ServiceProvider
12
{
13
    /* -----------------------------------------------------------------
14
     |  Properties
15
     | -----------------------------------------------------------------
16
     */
17
18
    /**
19
     * Package name.
20
     *
21
     * @var string
22
     */
23
    protected $package = 'spam-blocker';
24
25
    /* -----------------------------------------------------------------
26
     |  Main Methods
27
     | -----------------------------------------------------------------
28
     */
29
30
    /**
31
     * Register the service provider.
32
     */
33 126
    public function register()
34
    {
35 126
        parent::register();
36
37 126
        $this->registerConfig();
38
39 126
        $this->registerSpamBlocker();
40 126
    }
41
42
    /**
43
     * Boot the service provider.
44
     */
45 126
    public function boot()
46
    {
47 126
        parent::boot();
48
49 126
        $this->publishConfig();
50 126
    }
51
52
    /**
53
     * Get the services provided by the provider.
54
     *
55
     * @return array
56
     */
57 3
    public function provides()
58
    {
59
        return [
60 2
            Contracts\SpamBlocker::class
61 1
        ];
62
    }
63
64
    /* -----------------------------------------------------------------
65
     |  Other Methods
66
     | -----------------------------------------------------------------
67
     */
68
69
    /**
70
     * Register the spam blocker
71
     */
72
    private function registerSpamBlocker()
73
    {
74 126
        $this->singleton(Contracts\SpamBlocker::class, function ($app) {
75
            /** @var  \Illuminate\Contracts\Config\Repository  $config */
76 81
            $config = $app['config'];
77
78 81
            return new SpamBlocker(
79 81
                $config->get('spam-blocker')
80
            );
81 126
        });
82 126
    }
83
}
84