GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ModelMakeCommand   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 73
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A fire() 0 10 3
A getStub() 0 4 1
A getDefaultNamespace() 0 4 1
A getOptions() 0 6 1
1
<?php
2
3
namespace duxet\Rethinkdb\Console\Model;
4
5
use Illuminate\Console\GeneratorCommand as LaravelMakeModelCommand;
6
use Symfony\Component\Console\Input\InputOption;
7
8
class ModelMakeCommand extends LaravelMakeModelCommand
9
{
10
    /**
11
     * The console command name.
12
     *
13
     * @var string
14
     */
15
    protected $name = 'make:rethink-model';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Create a new Rethinkdb model class';
23
24
    /**
25
     * The type of class being generated.
26
     *
27
     * @var string
28
     */
29
    protected $type = 'Model';
30
31
    /**
32
     * Execute the console command.
33
     *
34
     * @return void
35
     */
36
    public function fire()
37
    {
38
        if (parent::fire() !== false) {
39
            if ($this->option('migration')) {
40
                $table = Str::plural(Str::snake(class_basename($this->argument('name'))));
0 ignored issues
show
Bug introduced by
It seems like $this->argument('name') targeting Illuminate\Console\Command::argument() can also be of type array; however, class_basename() does only seem to accept string|object, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
41
42
                $this->call('make:rethink-migration', ['name' => "create_{$table}_table", '--create' => $table]);
43
            }
44
        }
45
    }
46
47
    /**
48
     * Get the stub file for the generator.
49
     *
50
     * @return string
51
     */
52
    protected function getStub()
53
    {
54
        return __DIR__.'/stubs/model.stub';
55
    }
56
57
    /**
58
     * Get the default namespace for the class.
59
     *
60
     * @param string $rootNamespace
61
     *
62
     * @return string
63
     */
64
    protected function getDefaultNamespace($rootNamespace)
65
    {
66
        return $rootNamespace;
67
    }
68
69
    /**
70
     * Get the console command options.
71
     *
72
     * @return array
73
     */
74
    protected function getOptions()
75
    {
76
        return [
77
            ['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model.'],
78
        ];
79
    }
80
}
81