Passed
Push — master ( ed42e4...b3b06a )
by Kirill
04:44
created

OptionalCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A perform() 0 3 2
1
<?php
2
3
/**
4
 * Spiral Framework, SpiralScout LLC.
5
 *
6
 * @author    Anton Titov (Wolfy-J)
7
 */
8
9
declare(strict_types=1);
10
11
namespace Spiral\Tests\Console\Fixtures;
12
13
use Spiral\Console\Command;
14
use Symfony\Component\Console\Input\InputArgument;
15
use Symfony\Component\Console\Input\InputOption;
16
17
class OptionalCommand extends Command
18
{
19
    public const NAME = 'optional';
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public const OPTIONS = [
25
        ['option', 'o', InputOption::VALUE_NONE, 'Use option']
26
    ];
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public const ARGUMENTS = [
32
        ['arg', InputArgument::OPTIONAL, 'Value'],
33
    ];
34
35
    public function perform(): void
36
    {
37
        $this->write(!$this->option('option') ? 'no option' : $this->argument('arg'));
38
    }
39
}
40