Passed
Push — master ( 9bb89d...1caa12 )
by Gustavo
02:12
created

Command   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 8
c 1
b 1
f 0
dl 0
loc 23
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getModelArgument() 0 15 2
1
<?php
2
3
namespace Gurgentil\LaravelEloquentSequencer\Console\Commands;
4
5
use Exception;
6
use Illuminate\Console\Command as IlluminateCommand;
7
8
abstract class Command extends IlluminateCommand
9
{
10
    /**
11
     * Get model argument.
12
     *
13
     * @return string
14
     * @throws Exception
15
     */
16
    protected function getModelArgument(): string
17
    {
18
        $modelClass = $this->argument('model') ?? '';
19
20
        $modelClass = (string) $modelClass;
21
22
        if (! class_exists($modelClass)) {
23
            $message = "Model `{$modelClass}` not found.";
24
25
            $this->error($message);
26
27
            throw new Exception($message);
28
        }
29
30
        return $modelClass;
31
    }
32
}
33