1 | <?php |
||
22 | final class Application extends BaseApplication |
||
23 | { |
||
24 | const VERSION = '@package_version@'; |
||
25 | |||
26 | 4 | public function __construct(KernelInterface $kernel) |
|
33 | |||
34 | 2 | protected function getCommandName(InputInterface $input) |
|
35 | { |
||
36 | // the regular setDefaultCommand option does not allow for options and arguments; with this workaround |
||
37 | // we can have options and arguments when the first element in the argv options is not a recognized |
||
38 | // command name. |
||
39 | // We explicitly do not use the getFirstArgument of the $input variable since that skips options; we |
||
40 | // explicitly want to know if the first thing after the php filename is a known command! |
||
41 | 2 | if ((isset($_SERVER['argv'][1]) === false || $this->has($_SERVER['argv'][1]) === false)) { |
|
42 | 1 | return 'project:run'; |
|
43 | } |
||
44 | |||
45 | 1 | return $input->getFirstArgument(); |
|
46 | } |
||
47 | |||
48 | 1 | protected function getDefaultInputDefinition() |
|
49 | { |
||
50 | 1 | $inputDefinition = parent::getDefaultInputDefinition(); |
|
51 | |||
52 | 1 | $inputDefinition->addOption( |
|
53 | 1 | new InputOption( |
|
54 | 1 | 'config', |
|
55 | 1 | 'c', |
|
56 | 1 | InputOption::VALUE_OPTIONAL, |
|
57 | 1 | 'Location of a custom configuration file' |
|
58 | ) |
||
59 | ); |
||
60 | 1 | $inputDefinition->addOption( |
|
61 | 1 | new InputOption('log', null, InputOption::VALUE_OPTIONAL, 'Log file to write to') |
|
62 | ); |
||
63 | |||
64 | 1 | return $inputDefinition; |
|
65 | } |
||
66 | |||
67 | /** |
||
68 | * Returns the long version of the application. |
||
69 | * |
||
70 | * @return string The long application version |
||
71 | */ |
||
72 | 1 | public function getLongVersion(): string |
|
76 | |||
77 | 4 | private function detectVersion(): string |
|
92 | } |
||
93 |