HelpCommand   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
cbo 3
dl 0
loc 31
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A configure() 0 25 1
1
<?php
2
3
/*
4
 * This file is part of Bowerphp.
5
 *
6
 * (c) Massimiliano Arione <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Bowerphp\Command;
13
14
use Symfony\Component\Console\Command\HelpCommand as SymfonyHelpCommand;
15
use Symfony\Component\Console\Input\InputArgument;
16
use Symfony\Component\Console\Input\InputOption;
17
18
/**
19
 * This is just an extension of original HelpCommand, needed to remove the last line from help.
20
 * See also {@link https://github.com/Bee-Lab/bowerphp/issues/108}.
21
 */
22
class HelpCommand extends SymfonyHelpCommand
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    protected function configure()
28
    {
29
        $this->ignoreValidationErrors();
30
31
        $this
32
            ->setName('help')
33
            ->setDefinition([
34
                new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
35
                new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
36
                new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
37
                new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
38
            ])
39
            ->setDescription('Displays help for a command')
40
            ->setHelp(<<<'EOF'
41
The <info>%command.name%</info> command displays help for a given command:
42
43
  <info>php %command.full_name% list</info>
44
45
You can also output the help in other formats by using the <comment>--format</comment> option:
46
47
  <info>php %command.full_name% --format=xml list</info>
48
EOF
49
            )
50
        ;
51
    }
52
}
53