1 | <?php |
||
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) |
||
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() |
||
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() |
||
52 | |||
53 | /** |
||
54 | * Override parent method so that --help options is used when app is called with no arguments or options |
||
55 | * |
||
56 | * @param InputInterface|null $input |
||
57 | * @param OutputInterface|null $output |
||
58 | * @return int |
||
59 | * @throws \Exception |
||
60 | */ |
||
61 | public function run(InputInterface $input = null, OutputInterface $output = null) |
||
71 | } |
||
72 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: