CompileCommand::getDescription()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of Railt package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Railt\SDL\Console;
13
14
use Railt\SDL\Frontend\Generator;
15
use Symfony\Component\Console\Command\Command;
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
/**
20
 * Class CompileCommand
21
 */
22
class CompileCommand extends Command
23
{
24
    /**
25
     * {@inheritDoc}
26
     */
27
    public function getName(): string
28
    {
29
        return 'sdl:compile';
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    public function getDescription(): string
36
    {
37
        return 'A command to generate GraphQL lexer and parser by its (E)BNF-like grammar';
38
    }
39
40
    /**
41
     * {@inheritDoc}
42
     * @throws \Throwable
43
     */
44
    protected function execute(InputInterface $input, OutputInterface $output): int
45
    {
46
        $output->writeln('<comment>Generating</comment>');
47
48
        $generator = new Generator();
49
        $generator->generateAndSave();
50
51
        $out = \dirname(__DIR__) . '/Parser/Factory.php';
52
53
        $output->writeln('<info>Successfully generated in ' . $out . '</info>');
54
55
        return 0;
56
    }
57
}
58