Completed
Push — master ( d44234...ddcd57 )
by Adam
02:30
created

ServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 5
dl 0
loc 57
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
B register() 0 28 1
A provides() 0 4 1
1
<?php
2
3
namespace BestServedCold\LaravelZendSearch\Laravel;
4
5
use Illuminate\Support\ServiceProvider as Provider;
6
use BestServedCold\LaravelZendSearch\Laravel\Console\Rebuild;
7
use BestServedCold\LaravelZendSearch\Laravel\Console\Destroy;
8
use BestServedCold\LaravelZendSearch\Laravel\Console\Optimise;
9
10
/**
11
 * Class ServiceProvider
12
 * @package BestServedCold\LaravelZendSearch\Laravel
13
 */
14
class ServiceProvider extends Provider
15
{
16
    /**
17
     * Bootstrap the application services.
18
     *
19
     * @return             void
20
     * @codeCoverageIgnore
21
     */
22
    public function boot()
23
    {
24
        $this->mergeConfigFrom(__DIR__ . '/../../../config/search.php', 'search');
25
    }
26
27
    /**
28
     * Register the application services.
29
     *
30
     * @return             void
31
     * @codeCoverageIgnore
32
     */
33
    public function register()
34
    {
35
        $this->publishes(
36
            [
37
            __DIR__ . '/../../../config/search.php' => config_path('search.php'),
38
            ]
39
        );
40
41
        $this->app->singleton(
42
            'command.search.rebuild', function() {
43
                return new Rebuild;
44
            }
45
        );
46
47
        $this->app->singleton(
48
            'command.search.destroy', function() {
49
                return new Destroy;
50
            }
51
        );
52
53
        $this->app->singleton(
54
            'command.search.optimise', function() {
55
                return new Optimise;
56
            }
57
        );
58
59
        $this->commands([ 'command.search.rebuild', 'command.search.optimise', 'command.search.destroy' ]);
60
    }
61
62
63
    /**
64
     * @return array
65
     */
66 35
    public function provides()
67 35
    {
68 1
        return [ 'search', 'command.search.rebuild', 'command.search.optimise', 'command.search.destroy' ];
69
    }
70
}
71