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

BootloaderCommand::perform()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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