MetadataEnricherServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 10 1
1
<?php namespace Nwidart\LaravelBroadway\Broadway;
2
3
use Broadway\EventSourcing\EventStreamDecorator;
4
use Broadway\EventSourcing\MetadataEnrichment\MetadataEnrichingEventStreamDecorator;
5
use Illuminate\Support\ServiceProvider;
6
use Nwidart\LaravelBroadway\Registries\MetaDataEnricherRegistry;
7
8
/**
9
 * Class MetadataEnricherServiceProvider
10
 *
11
 * @package Nwidart\LaravelBroadway\Broadway
12
 * @author Stefano Kowalke <[email protected]>
13
 */
14
class MetadataEnricherServiceProvider extends ServiceProvider
15
{
16
17
    /**
18
     * Register the MetadataEnrichingEventStreamDecorator
19
     */
20
    public function register()
21
    {
22
        $this->app->singleton(EventStreamDecorator::class, function () {
23
            return new MetadataEnrichingEventStreamDecorator();
24
        });
25
26
        $this->app->singleton('laravelbroadway.enricher.registry', function ($app) {
27
            return new MetaDataEnricherRegistry($app[EventStreamDecorator::class]);
28
        });
29
    }
30
}
31