ServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 38
ccs 11
cts 11
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 6 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
use Triadev\PrometheusExporter\Provider\PrometheusExporterServiceProvider;
11
12
class ServiceProvider extends BaseServiceProvider
13
{
14
    /**
15
     * All of the container singletons that should be registered.
16
     *
17
     * @var array
18
     */
19
    public $singletons = [
20
        ElasticsearchDslContract::class => ElasticsearchDsl::class
21
    ];
22
    
23
    /**
24
     * Bootstrap the application events.
25
     *
26
     * @return void
27
     */
28 62
    public function boot()
29
    {
30 62
        $source = realpath(__DIR__ . '/../Config/config.php');
31
    
32 62
        $this->publishes([
33 62
            __DIR__ . '/../Config/config.php' => config_path('laravel-elasticsearch-dsl.php'),
34 62
        ], 'config');
35
    
36 62
        $this->mergeConfigFrom($source, 'laravel-elasticsearch-dsl');
37 62
    }
38
    
39
    /**
40
     * Register bindings in the container.
41
     *
42
     * @return void
43
     */
44 62
    public function register()
45
    {
46 62
        $this->app->register(ElasticsearchServiceProvider::class);
47 62
        $this->app->register(PrometheusExporterServiceProvider::class);
48
    
49 62
        AliasLoader::getInstance()->alias('ElasticDsl', ElasticDsl::class);
50 62
    }
51
}
52