@@ -172,19 +172,7 @@ public static function forgetBootstrappers()
172
172
*/
173
173
public function call ($ command , array $ parameters = [], $ outputBuffer = null )
174
174
{
175
- if (is_subclass_of ($ command , SymfonyCommand::class)) {
176
- $ callingClass = true ;
177
- $ command = $ this ->laravel ->make ($ command )->getName ();
178
- }
179
-
180
- if (! isset ($ callingClass ) && empty ($ parameters )) {
181
- $ command = $ this ->getCommandName (
182
- $ input = new StringInput ($ command )
183
- );
184
- } else {
185
- array_unshift ($ parameters , $ command );
186
- $ input = new ArrayInput ($ parameters );
187
- }
175
+ [$ command , $ input ] = $ this ->parseCommand ($ command , $ parameters );
188
176
189
177
if (! $ this ->has ($ command )) {
190
178
throw new CommandNotFoundException (sprintf ('The command "%s" does not exist. ' , $ command ));
@@ -201,6 +189,32 @@ public function call($command, array $parameters = [], $outputBuffer = null)
201
189
return $ result ;
202
190
}
203
191
192
+ /**
193
+ * Parse the incoming Artisan command and its input.
194
+ *
195
+ * @param string $command
196
+ * @param array $parameters
197
+ * @return array
198
+ */
199
+ protected function parseCommand ($ command , $ parameters )
200
+ {
201
+ if (is_subclass_of ($ command , SymfonyCommand::class)) {
202
+ $ callingClass = true ;
203
+
204
+ $ command = $ this ->laravel ->make ($ command )->getName ();
205
+ }
206
+
207
+ if (! isset ($ callingClass ) && empty ($ parameters )) {
208
+ $ command = $ this ->getCommandName ($ input = new StringInput ($ command ));
209
+ } else {
210
+ array_unshift ($ parameters , $ command );
211
+
212
+ $ input = new ArrayInput ($ parameters );
213
+ }
214
+
215
+ return [$ command , $ input ?? null ];
216
+ }
217
+
204
218
/**
205
219
* Get the output for the last run command.
206
220
*
0 commit comments