CreateEventStoreCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 13 1
A getArguments() 0 6 1
1
<?php namespace Nwidart\LaravelBroadway\Console;
2
3
use Illuminate\Console\Command;
4
use Symfony\Component\Console\Input\InputArgument;
5
6
class CreateEventStoreCommand extends Command
7
{
8
    protected $name = 'broadway:event-store:migrate';
9
    protected $description = 'This will create the events store table based on the name in the configuration';
10
11
    public function handle()
12
    {
13
        $table = $this->argument('table');
14
        $this->laravel->config['broadway.event-store.table'] = $table;
15
16
        $migrations = app('migration.repository');
17
        $migrations->createRepository();
18
19
        $migrator = app('migrator');
20
        $migrator->run(__DIR__ . '/../../migrations');
21
22
        $this->info("Table [$table] created!");
23
    }
24
25
    protected function getArguments()
26
    {
27
        return [
28
            ['table', InputArgument::REQUIRED, 'Override the event store table name']
29
        ];
30
    }
31
}
32