LaravelBroadwayServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 37
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 13 1
A registerConfiguration() 0 6 1
A registerMigrations() 0 6 1
1
<?php namespace Nwidart\LaravelBroadway;
2
3
use Illuminate\Support\ServiceProvider;
4
5
class LaravelBroadwayServiceProvider extends ServiceProvider
6
{
7
    public function register()
8
    {
9
        $this->registerConfiguration();
10
        $this->registerMigrations();
11
12
        $this->app->register(\Nwidart\LaravelBroadway\Broadway\EventServiceProvider::class);
13
        $this->app->register(\Nwidart\LaravelBroadway\Broadway\CommandServiceProvider::class);
14
        $this->app->register(\Nwidart\LaravelBroadway\Broadway\SerializersServiceProvider::class);
15
        $this->app->register(\Nwidart\LaravelBroadway\Broadway\EventStorageServiceProvider::class);
16
        $this->app->register(\Nwidart\LaravelBroadway\Broadway\SupportServiceProvider::class);
17
        $this->app->register(\Nwidart\LaravelBroadway\Broadway\ReadModelServiceProvider::class);
18
        $this->app->register(\Nwidart\LaravelBroadway\Broadway\MetadataEnricherServiceProvider::class);
19
    }
20
21
    /**
22
     * Register the configuration file so Laravel can publish them
23
     * Also merges the published config file with original
24
     */
25
    private function registerConfiguration()
26
    {
27
        $configPath = __DIR__ . '/../config/broadway.php';
28
        $this->mergeConfigFrom($configPath, 'broadway');
29
        $this->publishes([$configPath => config_path('broadway.php')]);
30
    }
31
32
    /**
33
     * Register the migrations so Laravel can publish them
34
     */
35
    private function registerMigrations()
36
    {
37
        $this->publishes([
38
            __DIR__ . '/../migrations' => base_path('database/migrations'),
39
        ]);
40
    }
41
}
42