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.

ControllerCommand   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 83
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getArguments() 0 11 1
A getOptions() 0 12 1
A fire() 0 19 2
1
<?php
2
3
namespace Milkmeowo\Framework\Repository\Generators\Commands;
4
5
use Illuminate\Console\Command;
6
use Symfony\Component\Console\Input\InputOption;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Milkmeowo\Framework\Repository\Generators\RoutesGenerator;
9
use Milkmeowo\Framework\Repository\Generators\ControllerGenerator;
10
use Milkmeowo\Framework\Repository\Generators\Exceptions\FileAlreadyExistsException;
11
12
class ControllerCommand extends Command
13
{
14
    /**
15
     * The name of command.
16
     *
17
     * @var string
18
     */
19
    protected $name = 'starter:resource';
20
21
    /**
22
     * The description of command.
23
     *
24
     * @var string
25
     */
26
    protected $description = 'Create a new RESTfull controller.';
27
28
    /**
29
     * The type of class being generated.
30
     *
31
     * @var string
32
     */
33
    protected $type = 'Controller';
34
35
    /**
36
     * Execute the command.
37
     *
38
     * @return void
39
     */
40
    public function fire()
41
    {
42
        try {
43
            (new ControllerGenerator([
44
                'name' => $this->argument('name'),
45
                'force' => $this->option('force'),
46
            ]))->run();
47
            $this->info($this->type.' created successfully.');
48
        } catch (FileAlreadyExistsException $e) {
49
            $this->error($this->type.' already exists!');
50
51
            //return false;
52
        }
53
54
        (new RoutesGenerator([
55
            'name' => $this->argument('name'),
56
            'force' => $this->option('force'),
57
        ]))->run();
58
    }
59
60
    /**
61
     * The array of command arguments.
62
     *
63
     * @return array
64
     */
65
    public function getArguments()
66
    {
67
        return [
68
            [
69
                'name',
70
                InputArgument::REQUIRED,
71
                'The name of model for which the controller is being generated.',
72
                null,
73
            ],
74
        ];
75
    }
76
77
    /**
78
     * The array of command options.
79
     *
80
     * @return array
81
     */
82
    public function getOptions()
83
    {
84
        return [
85
            [
86
                'force',
87
                'f',
88
                InputOption::VALUE_NONE,
89
                'Force the creation if file already exists.',
90
                null,
91
            ],
92
        ];
93
    }
94
}
95