TldrApplication   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
c 3
b 0
f 0
lcom 0
cbo 3
dl 0
loc 42
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCommandName() 0 5 1
A getDefaultCommands() 0 8 1
A getDefinition() 0 8 1
1
<?php
2
3
namespace GarethEllis\Tldr\Console;
4
5
use GarethEllis\Tldr\Console\Command\TldrCommand;
6
use Symfony\Component\Console\Application;
7
use Symfony\Component\Console\Input\ArgvInput;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class TldrApplication extends Application
12
{
13
    /**
14
     * Gets the name of the command based on input.
15
     *
16
     * @param InputInterface $input The input interface
17
     *
18
     * @return string The command name
19
     */
20
    protected function getCommandName(InputInterface $input)
21
    {
22
        // This should return the name of your command.
23
        return 'tldr';
24
    }
25
26
    /**
27
     * Gets the default commands that should always be available.
28
     *
29
     * @return array An array of default Command instances
30
     */
31
    protected function getDefaultCommands()
32
    {
33
        // Keep the core default commands to have the HelpCommand
34
        // which is used when using the --help option
35
        $defaultCommands = parent::getDefaultCommands();
36
        $defaultCommands[] = new TldrCommand();
37
        return $defaultCommands;
38
    }
39
40
    /**
41
     * Overridden so that the application doesn't expect the command
42
     * name to be the first argument.
43
     */
44
    public function getDefinition()
45
    {
46
        $inputDefinition = parent::getDefinition();
47
        // clear out the normal first argument, which is the command name
48
        $inputDefinition->setArguments();
49
50
        return $inputDefinition;
51
    }
52
}
53