Passed
Push — master ( a6b189...673d08 )
by Christopher
02:32
created

ElasticsearchServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 27
ccs 9
cts 9
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 4 1
1
<?php
2
namespace Triadev\Es\Provider;
3
4
use Triadev\Es\Contract\ElasticsearchContract;
5
use Triadev\Es\Elasticsearch;
6
use Illuminate\Support\ServiceProvider;
7
8
class ElasticsearchServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application events.
12
     *
13
     * @return void
14
     */
15 1
    public function boot()
16
    {
17 1
        $source = realpath(__DIR__ . '/../Config/config.php');
18
19 1
        $this->publishes([
20 1
            __DIR__ . '/../Config/config.php' => config_path('triadev-elasticsearch.php'),
21 1
        ], 'config');
22
23 1
        $this->mergeConfigFrom($source, 'triadev-elasticsearch');
24 1
    }
25
26
    /**
27
     * Register bindings in the container.
28
     *
29
     * @return void
30
     */
31 1
    public function register()
32
    {
33
        $this->app->singleton(ElasticsearchContract::class, function () {
34 1
            return app()->make(Elasticsearch::class);
35 1
        });
36 1
    }
37
}
38