File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
src/Symfony/Components/Console/Command Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,25 @@ protected function interact(InputInterface $input, OutputInterface $output)
104
104
{
105
105
}
106
106
107
+ /**
108
+ * Initializes the command just after the input has been validated.
109
+ *
110
+ * This is mainly useful when a lot of commands extends one main command
111
+ * where some things need to be initialized based on the input arguments and options.
112
+ *
113
+ * @param InputInterface $input An InputInterface instance
114
+ * @param OutputInterface $output An OutputInterface instance
115
+ */
116
+ protected function initialize (InputInterface $ input , OutputInterface $ output )
117
+ {
118
+ }
119
+
120
+ /**
121
+ * Runs the command.
122
+ *
123
+ * @param InputInterface $input An InputInterface instance
124
+ * @param OutputInterface $output An OutputInterface instance
125
+ */
107
126
public function run (InputInterface $ input , OutputInterface $ output )
108
127
{
109
128
// add the application arguments and options
@@ -122,6 +141,8 @@ public function run(InputInterface $input, OutputInterface $output)
122
141
}
123
142
}
124
143
144
+ $ this ->initialize ($ input , $ output );
145
+
125
146
if ($ input ->isInteractive ())
126
147
{
127
148
$ this ->interact ($ input , $ output );
You can’t perform that action at this time.
0 commit comments