File tree 2 files changed +43
-38
lines changed
2 files changed +43
-38
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env php
2
2
<?php
3
3
4
- use Bamarni \Symfony \Console \Autocomplete \DumpCommand ;
5
- use Symfony \Component \Console \Application as BaseApplication ;
6
- use Symfony \Component \Console \Command \Command ;
7
- use Symfony \Component \Console \Input \InputDefinition ;
8
- use Symfony \Component \Console \Input \InputInterface ;
9
4
10
5
if (file_exists ($ autoload = __DIR__ .'/../../../autoload.php ' )) {
11
6
require_once $ autoload ;
12
7
} else {
13
8
require_once __DIR__ .'/../vendor/autoload.php ' ;
14
9
}
15
10
16
- class Application extends BaseApplication
17
- {
18
- private $ command ;
11
+ use Bamarni \Symfony \Console \Autocomplete \Application ;
19
12
20
- public function __construct (Command $ command )
21
- {
22
- $ this ->command = $ command ;
23
-
24
- parent ::__construct ();
25
- }
26
-
27
- protected function getCommandName (InputInterface $ input ): ?string
28
- {
29
- return $ this ->command ->getName ();
30
- }
31
-
32
- protected function getDefaultCommands (): array
33
- {
34
- $ defaultCommands = parent ::getDefaultCommands ();
35
- $ defaultCommands [] = $ this ->command ;
36
-
37
- return $ defaultCommands ;
38
- }
39
-
40
- public function getDefinition (): InputDefinition
41
- {
42
- $ inputDefinition = parent ::getDefinition ();
43
- $ inputDefinition ->setArguments ();
44
-
45
- return $ inputDefinition ;
46
- }
47
- }
48
-
49
- $ console = new Application (new DumpCommand );
13
+ $ console = new Application ();
50
14
$ console ->run ();
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Bamarni \Symfony \Console \Autocomplete ;
4
+
5
+ use Symfony \Component \Console \Application as BaseApplication ;
6
+ use Symfony \Component \Console \Command \Command ;
7
+ use Symfony \Component \Console \Input \InputDefinition ;
8
+ use Symfony \Component \Console \Input \InputInterface ;
9
+
10
+ class Application extends BaseApplication
11
+ {
12
+ private $ command ;
13
+
14
+ public function __construct (Command $ command = null )
15
+ {
16
+ $ this ->command = $ command ?? new DumpCommand ;
17
+
18
+ parent ::__construct ();
19
+ }
20
+
21
+ protected function getCommandName (InputInterface $ input ): ?string
22
+ {
23
+ return $ this ->command ->getName ();
24
+ }
25
+
26
+ protected function getDefaultCommands (): array
27
+ {
28
+ $ defaultCommands = parent ::getDefaultCommands ();
29
+ $ defaultCommands [] = $ this ->command ;
30
+
31
+ return $ defaultCommands ;
32
+ }
33
+
34
+ public function getDefinition (): InputDefinition
35
+ {
36
+ $ inputDefinition = parent ::getDefinition ();
37
+ $ inputDefinition ->setArguments ();
38
+
39
+ return $ inputDefinition ;
40
+ }
41
+ }
You can’t perform that action at this time.
0 commit comments