CompileCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 9
dl 0
loc 34
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A getDescription() 0 3 1
A execute() 0 12 1
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