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.
Completed
Pull Request — master (#44)
by Tom
01:22
created

MakeEnum::getValueMapConst()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 9
cts 9
cp 1
rs 9.7
c 0
b 0
f 0
cc 3
nc 2
nop 0
crap 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A MakeEnum::getOptions() 0 6 1
1
<?php
2
3
namespace Spatie\Enum\Laravel\Commands;
4
5
use Illuminate\Console\GeneratorCommand;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputOption;
8
9
class MakeEnum extends GeneratorCommand
10
{
11
    protected $name = 'make:enum';
12
    protected $description = 'Create a new enum';
13
14
    public function handle()
15 36
    {
16
        $this->type = $this->getNameInput();
17 36
18
        return parent::handle();
19
    }
20 36
21
    protected function getStub()
22 36
    {
23
        return __DIR__.'/../../stubs/enum.php.stub';
24
    }
25 36
26
    protected function getDefaultNamespace($rootNamespace)
27 36
    {
28
        return $rootNamespace.'\Enums';
29 36
    }
30 36
31
    protected function replaceClass($stub, $name)
32 36
    {
33
        $stub = parent::replaceClass($stub, $name);
34
35 36
        $stub = str_replace('/** DummyDocBlock */', $this->getDocBlock(), $stub);
36
37 36
        return $stub;
38
    }
39 36
40 32
    protected function getDocBlock(): string
41
    {
42 32
        $methods = $this->option('method');
43 32
44 32
        if (! empty($methods)) {
45
            $docBlock = PHP_EOL.'/**';
46
            $docBlock .= implode('', array_map(function ($method) {
47 36
                return PHP_EOL.' * @method static self '.$method.'()';
48
            }, $methods));
49
            $docBlock .= PHP_EOL.' */';
50 36
        }
51
52 36
        return $docBlock ?? '';
53
    }
54 36
55 16
    protected function getArguments()
56 16
    {
57
        return [
58 16
            ['name', InputArgument::REQUIRED, 'The name of the enum'],
59 16
        ];
60
    }
61
62 16
    protected function getOptions()
63
    {
64
        return [
65 36
            ['method', 'm', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'The method name that should be added to the enum'],
66
        ];
67
    }
68
}
69