EventSauceServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 36
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 2
A register() 0 12 1
A provides() 0 6 1
1
<?php
2
3
namespace Chocofamily\LaravelEventSauce;
4
5
use Chocofamily\LaravelEventSauce\Console\GenerateCommand;
6
use Chocofamily\LaravelEventSauce\Console\MakeAggregateCommand;
7
use Chocofamily\LaravelEventSauce\Console\MakeConsumerCommand;
8
use EventSauce\EventSourcing\Serialization\ConstructingMessageSerializer;
9
use EventSauce\EventSourcing\Serialization\MessageSerializer;
10
use Illuminate\Support\ServiceProvider;
11
12
final class EventSauceServiceProvider extends ServiceProvider
13
{
14
    public function boot()
15
    {
16
        if ($this->app->runningInConsole()) {
17
            $this->publishes([
18
                __DIR__.'/../config/eventsauce.php' => $this->app->configPath('eventsauce.php'),
19
            ], ['eventsauce', 'eventsauce-config']);
20
21
            $this->publishes([
22
                __DIR__.'/../database/migrations' => $this->app->databasePath('migrations'),
23
            ], ['eventsauce', 'eventsauce-migrations']);
24
        }
25
    }
26
27
    public function register()
28
    {
29
        $this->mergeConfigFrom(__DIR__.'/../config/eventsauce.php', 'eventsauce');
30
31
        $this->app->bind(MessageSerializer::class, function () {
32
            return new ConstructingMessageSerializer();
33
        });
34
35
        $this->commands([
36
            GenerateCommand::class,
37
            MakeAggregateCommand::class,
38
            MakeConsumerCommand::class,
39
        ]);
40
    }
41
42
    public function provides()
43
    {
44
        return [
45
            GenerateCommand::class,
46
            MakeAggregateCommand::class,
47
            MakeConsumerCommand::class,
48
        ];
49
    }
50
}
51