FormatterCli   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 40
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCommandName() 0 3 1
A getDefaultCommands() 0 9 1
A getDefinition() 0 7 1
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