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

ServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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