Completed
Pull Request — master (#1)
by Christopher
04:52
created

ServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 37
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 9 1
A register() 0 5 1
1
<?php
2
namespace Triadev\Es\Dsl\Provider;
3
4
use Illuminate\Foundation\AliasLoader;
5
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
6
use Triadev\Es\Dsl\Contract\ElasticsearchDslContract;
7
use Triadev\Es\Dsl\ElasticsearchDsl;
8
use Triadev\Es\Dsl\Facade\ElasticDsl;
9
use Triadev\Es\Provider\ElasticsearchServiceProvider;
10
11
class ServiceProvider extends BaseServiceProvider
12
{
13
    /**
14
     * All of the container singletons that should be registered.
15
     *
16
     * @var array
17
     */
18
    public $singletons = [
19
        ElasticsearchDslContract::class => ElasticsearchDsl::class
20
    ];
21
    
22
    /**
23
     * Bootstrap the application events.
24
     *
25
     * @return void
26
     */
27 61
    public function boot()
28
    {
29 61
        $source = realpath(__DIR__ . '/../Config/config.php');
30
    
31 61
        $this->publishes([
32 61
            __DIR__ . '/../Config/config.php' => config_path('laravel-elasticsearch-dsl.php'),
33 61
        ], 'config');
34
    
35 61
        $this->mergeConfigFrom($source, 'laravel-elasticsearch-dsl');
36 61
    }
37
    
38
    /**
39
     * Register bindings in the container.
40
     *
41
     * @return void
42
     */
43 61
    public function register()
44
    {
45 61
        $this->app->register(ElasticsearchServiceProvider::class);
46
    
47 61
        AliasLoader::getInstance()->alias('ElasticDsl', ElasticDsl::class);
48 61
    }
49
}
50