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

HelperCommand   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 18
c 1
b 0
f 0
dl 0
loc 30
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A perform() 0 19 6
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
16
class HelperCommand extends Command
17
{
18
    public const NAME = 'helper';
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public const ARGUMENTS = [
24
        ['helper', InputArgument::REQUIRED, 'Helper'],
25
    ];
26
27
    public function perform(): void
28
    {
29
        switch ($this->argument('helper')) {
30
            case 'verbose':
31
                $this->write($this->isVerbose() ? 'true' : 'false');
32
                break;
33
34
            case 'sprintf':
35
                $this->sprintf('%s world', 'hello');
36
                break;
37
38
            case 'writeln':
39
                $this->writeln('hello');
40
                break;
41
42
            case 'table':
43
                $table = $this->table(['id', 'value']);
44
                $table->addRow(['1', 'true']);
45
                $table->render();
46
        }
47
    }
48
}
49