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.

CriteriaCommand::getArguments()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 11
loc 11
rs 9.4285
c 0
b 0
f 0
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\CriteriaGenerator;
9
use Milkmeowo\Framework\Repository\Generators\Exceptions\FileAlreadyExistsException;
10
11 View Code Duplication
class CriteriaCommand extends Command
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /**
14
     * The name of command.
15
     *
16
     * @var string
17
     */
18
    protected $name = 'starter:criteria';
19
20
    /**
21
     * The description of command.
22
     *
23
     * @var string
24
     */
25
    protected $description = 'Create a new criteria.';
26
27
    /**
28
     * The type of class being generated.
29
     *
30
     * @var string
31
     */
32
    protected $type = 'Criteria';
33
34
    /**
35
     * Execute the command.
36
     *
37
     * @return void
38
     */
39
    public function fire()
40
    {
41
        try {
42
            (new CriteriaGenerator([
43
                'name' => $this->argument('name'),
44
                'force' => $this->option('force'),
45
            ]))->run();
46
47
            $this->info('Criteria created successfully.');
48
        } catch (FileAlreadyExistsException $ex) {
49
            $this->error($this->type.' already exists!');
50
51
            return false;
52
        }
53
    }
54
55
    /**
56
     * The array of command arguments.
57
     *
58
     * @return array
59
     */
60
    public function getArguments()
61
    {
62
        return [
63
            [
64
                'name',
65
                InputArgument::REQUIRED,
66
                'The name of class being generated.',
67
                null,
68
            ],
69
        ];
70
    }
71
72
    /**
73
     * The array of command options.
74
     *
75
     * @return array
76
     */
77
    public function getOptions()
78
    {
79
        return [
80
            [
81
                'force',
82
                'f',
83
                InputOption::VALUE_NONE,
84
                'Force the creation if file already exists.',
85
                null,
86
            ],
87
        ];
88
    }
89
}
90