Passed
Pull Request — master (#806)
by Maxim
19:17
created

BootloaderCommand   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 13
c 0
b 0
f 0
dl 0
loc 26
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A perform() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Scaffolder\Command;
6
7
use Spiral\Scaffolder\Declaration\BootloaderDeclaration;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Symfony\Component\Console\Input\InputOption;
10
11
class BootloaderCommand extends AbstractCommand
12
{
13
    protected const NAME        = 'create:bootloader';
14
    protected const DESCRIPTION = 'Create bootloader declaration';
15
    protected const ARGUMENTS   = [
16
        ['name', InputArgument::REQUIRED, 'bootloader name'],
17
    ];
18
    protected const OPTIONS     = [
19
        [
20
            'comment',
21
            'c',
22
            InputOption::VALUE_OPTIONAL,
23
            'Optional comment to add as class header',
24
        ],
25
    ];
26
27
    /**
28
     * Create bootloader declaration.
29
     */
30 1
    public function perform(): int
31
    {
32 1
        $declaration = $this->createDeclaration(BootloaderDeclaration::class);
33
34 1
        $this->writeDeclaration($declaration);
35
36 1
        return self::SUCCESS;
37
    }
38
}
39