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

HelperCommand::perform()   A

Complexity

Conditions 6
Paths 5

Size

Total Lines 19
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 19
rs 9.2222
cc 6
nc 5
nop 0
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