CommandServiceProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php namespace Nwidart\LaravelBroadway\Broadway;
2
3
use Broadway\CommandHandling\SimpleCommandBus;
4
use Illuminate\Support\ServiceProvider;
5
use Nwidart\LaravelBroadway\Registries\CommandRegistry;
6
7
class CommandServiceProvider extends ServiceProvider
8
{
9
    public function register()
10
    {
11
        $this->app->singleton(\Broadway\CommandHandling\CommandBus::class, function () {
12
            return new SimpleCommandBus();
13
        });
14
15
        $this->app->singleton('laravelbroadway.command.registry', function ($app) {
16
            return new CommandRegistry($app[\Broadway\CommandHandling\CommandBus::class]);
17
        });
18
    }
19
}
20