ElasticsearchServiceProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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