Test Failed
Push — master ( e042c7...883f5c )
by Hannes
02:15
created

Application::getCommandName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace hanneskod\readmetester\Console;
6
7
use Symfony\Component\Console\Input\InputInterface;
8
9
/**
10
 * Symfony single command application
11
 */
12
class Application extends \Symfony\Component\Console\Application
13
{
14
    /**
15
     * Gets the name of the command based on input.
16
     *
17
     * @param InputInterface $input The input interface
18
     *
19
     * @return string The command name
20
     */
21
    protected function getCommandName(InputInterface $input)
22
    {
23
        // This should return the name of your command.
24
        return 'test';
25
    }
26
27
    /**
28
     * Gets the default commands that should always be available.
29
     *
30
     * @return array An array of default Command instances
31
     */
32
    protected function getDefaultCommands()
33
    {
34
        // Keep the core default commands to have the HelpCommand
35
        // which is used when using the --help option
36
        $defaultCommands = parent::getDefaultCommands();
37
38
        $defaultCommands[] = new TestCommand();
39
40
        return $defaultCommands;
41
    }
42
43
    /**
44
     * Overridden so that the application doesn't expect the command
45
     * name to be the first argument.
46
     */
47
    public function getDefinition()
48
    {
49
        $inputDefinition = parent::getDefinition();
50
        // clear out the normal first argument, which is the command name
51
        $inputDefinition->setArguments();
52
53
        return $inputDefinition;
54
    }
55
}
56