Completed
Push — master ( cfc96c...883ebd )
by Gino
03:17 queued 01:42
created

MigrateFromPlugin   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 9 2
A getArguments() 0 10 1
1
<?php
2
3
namespace GinoPane\BlogTaxonomy\Console;
4
5
use Exception;
6
use Illuminate\Console\Command;
7
use Symfony\Component\Console\Input\InputArgument;
8
use GinoPane\BlogTaxonomy\Classes\MigrationCommand\MigrationFactory;
9
10
class MigrateFromPlugin extends Command
11
{
12
    const NAME = 'blogtaxonomy:migratefromplugin';
13
14
    /**
15
     * @var string The console command name.
16
     */
17
    protected $name = 'blogtaxonomy:migratefromplugin';
18
19
    /**
20
     * @var string The console command description.
21
     */
22
    protected $description = 'Migrate from another plugin to the Blog Taxonomy';
23
24
    /**
25
     * Execute the console command.
26
     * @return void
27
     */
28
    public function handle()
29
    {
30
        try {
31
            MigrationFactory::resolve($this->argument('plugin'), $this)
32
                ->migrate();
33
        } catch (Exception $exception) {
34
            $this->error($exception->getMessage());
35
        }
36
    }
37
38
    /**
39
     * Get the console command arguments.
40
     * @return array
41
     */
42
    protected function getArguments(): array
43
    {
44
        return [
45
            [
46
                'plugin',
47
                InputArgument::REQUIRED,
48
                'A plugin to migrate from. Supported plugins are: PKleindienst.BlogSeries'
49
            ]
50
        ];
51
    }
52
}
53