Skip to content

Commit faa3923

Browse files
Minor code refactor
1 parent 4a013a2 commit faa3923

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/Maker/MakeCommand.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,10 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
4343
public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator)
4444
{
4545
$commandName = trim($input->getArgument('name'));
46-
$classNameSrc = $commandName;
47-
if (0 === strpos($commandName, 'app:')) {
48-
$classNameSrc = substr($classNameSrc, 4);
49-
}
46+
$commandNameHasAppPrefix = 0 === strpos($commandName, 'app:');
5047

5148
$commandClassNameDetails = $generator->createClassNameDetails(
52-
$classNameSrc,
49+
$commandNameHasAppPrefix ? substr($commandName, 4) : $commandName,
5350
'Command\\',
5451
'Command',
5552
sprintf('The "%s" command name is not valid because it would be implemented by "%s" class, which is not valid as a PHP class name (it must start with a letter or underscore, followed by any number of letters, numbers, or underscores).', $commandName, Str::asClassName($commandName, 'Command'))

0 commit comments

Comments
 (0)