FormatterCli::getDefinition()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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