Skip to content

Commit ce60831

Browse files
authored
minor #1605 Move help files into new directory structure
* add helper method to get the help file contents for each maker * move help files to new config dir
1 parent 6e1ed41 commit ce60831

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+56
-36
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
The <info>%command.name%</info> command generates or updates databases services in compose.yaml
2-
3-
<info>php %command.full_name%</info>
4-
5-
Supports MySQL, MariaDB and PostgreSQL
1+
The <info>%command.name%</info> command generates or updates databases services in compose.yaml
2+
3+
<info>php %command.full_name%</info>
4+
5+
Supports MySQL, MariaDB and PostgreSQL
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/Maker/AbstractMaker.php

+13
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,17 @@ protected function addDependencies(array $dependencies, ?string $message = null)
5555
$message
5656
);
5757
}
58+
59+
/**
60+
* Get the help file contents needed for "setHelp()" of a maker.
61+
*
62+
* @param string $helpFileName the filename (omit path) of the help file located in config/help/
63+
* e.g. MakeController.txt
64+
*
65+
* @internal
66+
*/
67+
final protected function getHelpFileContents(string $helpFileName): string
68+
{
69+
return file_get_contents(\sprintf('%s/config/help/%s', \dirname(__DIR__, 2), $helpFileName));
70+
}
5871
}

src/Maker/Common/CanGenerateTestsTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ trait CanGenerateTestsTrait
2828

2929
public function configureCommandWithTestsOption(Command $command): Command
3030
{
31-
$testsHelp = file_get_contents(\dirname(__DIR__, 2).'/Resources/help/_WithTests.txt');
31+
$testsHelp = file_get_contents(\dirname(__DIR__, 3).'/config/help/_WithTests.txt');
3232
$help = $command->getHelp()."\n".$testsHelp;
3333

3434
$command

src/Maker/Common/UidTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ trait UidTrait
3434
*/
3535
protected function addWithUuidOption(Command $command): Command
3636
{
37-
$uidHelp = file_get_contents(\dirname(__DIR__, 2).'/Resources/help/_WithUid.txt');
37+
$uidHelp = file_get_contents(\dirname(__DIR__, 3).'/config/help/_WithUid.txt');
3838
$help = $command->getHelp()."\n".$uidHelp;
3939

4040
$command

src/Maker/MakeAuthenticator.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public static function getCommandDescription(): string
9292
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
9393
{
9494
$command
95-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeAuth.txt'));
95+
->setHelp($this->getHelpFileContents('MakeAuth.txt'))
96+
;
9697
}
9798

9899
public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void

src/Maker/MakeCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
5858
{
5959
$command
6060
->addArgument('name', InputArgument::OPTIONAL, \sprintf('Choose a command name (e.g. <fg=yellow>app:%s</>)', Str::asCommand(Str::getRandomTerm())))
61-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeCommand.txt'))
61+
->setHelp($this->getHelpFileContents('MakeCommand.txt'))
6262
;
6363
}
6464

src/Maker/MakeController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
7070
->addArgument('controller-class', InputArgument::OPTIONAL, \sprintf('Choose a name for your controller class (e.g. <fg=yellow>%sController</>)', Str::asClassName(Str::getRandomTerm())))
7171
->addOption('no-template', null, InputOption::VALUE_NONE, 'Use this option to disable template generation')
7272
->addOption('invokable', 'i', InputOption::VALUE_NONE, 'Use this option to create an invokable controller')
73-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeController.txt'))
73+
->setHelp($this->getHelpFileContents('MakeController.txt'))
7474
;
7575

7676
$this->configureCommandWithTestsOption($command);

src/Maker/MakeCrud.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
7171
{
7272
$command
7373
->addArgument('entity-class', InputArgument::OPTIONAL, \sprintf('The class name of the entity to create CRUD (e.g. <fg=yellow>%s</>)', Str::asClassName(Str::getRandomTerm())))
74-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeCrud.txt'))
74+
->setHelp($this->getHelpFileContents('MakeCrud.txt'))
7575
;
7676

7777
$inputConfig->setArgumentAsNonInteractive('entity-class');

src/Maker/MakeDockerDatabase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static function getCommandDescription(): string
6565
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
6666
{
6767
$command
68-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeDockerDatabase.txt'))
68+
->setHelp($this->getHelpFileContents('MakeDockerDatabase.txt'))
6969
;
7070
}
7171

src/Maker/MakeEntity.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
9797
->addOption('broadcast', 'b', InputOption::VALUE_NONE, 'Add the ability to broadcast entity updates using Symfony UX Turbo?')
9898
->addOption('regenerate', null, InputOption::VALUE_NONE, 'Instead of adding new fields, simply generate the methods (e.g. getter/setter) for existing fields')
9999
->addOption('overwrite', null, InputOption::VALUE_NONE, 'Overwrite any existing getter/setter methods')
100-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeEntity.txt'))
100+
->setHelp($this->getHelpFileContents('MakeEntity.txt'))
101101
;
102102

103103
$this->addWithUuidOption($command);

src/Maker/MakeFixtures.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
4444
{
4545
$command
4646
->addArgument('fixtures-class', InputArgument::OPTIONAL, 'The class name of the fixtures to create (e.g. <fg=yellow>AppFixtures</>)')
47-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeFixture.txt'))
47+
->setHelp($this->getHelpFileContents('MakeFixture.txt'))
4848
;
4949
}
5050

src/Maker/MakeForm.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
5353
$command
5454
->addArgument('name', InputArgument::OPTIONAL, \sprintf('The name of the form class (e.g. <fg=yellow>%sType</>)', Str::asClassName(Str::getRandomTerm())))
5555
->addArgument('bound-class', InputArgument::OPTIONAL, 'The name of Entity or fully qualified model class name that the new form will be bound to (empty for none)')
56-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeForm.txt'))
56+
->setHelp($this->getHelpFileContents('MakeForm.txt'))
5757
;
5858

5959
$inputConfig->setArgumentAsNonInteractive('bound-class');

src/Maker/MakeFunctionalTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
5050
{
5151
$command
5252
->addArgument('name', InputArgument::OPTIONAL, 'The name of the functional test class (e.g. <fg=yellow>DefaultControllerTest</>)')
53-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeFunctionalTest.txt'))
53+
->setHelp($this->getHelpFileContents('MakeFunctionalTest.txt'))
5454
;
5555
}
5656

src/Maker/MakeListener.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
6666
$command
6767
->addArgument('name', InputArgument::OPTIONAL, 'Choose a class name for your event listener or subscriber (e.g. <fg=yellow>ExceptionListener</> or <fg=yellow>ExceptionSubscriber</>)')
6868
->addArgument('event', InputArgument::OPTIONAL, 'What event do you want to listen to?')
69-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeListener.txt'))
69+
->setHelp($this->getHelpFileContents('MakeListener.txt'))
7070
;
7171

7272
$inputConfig->setArgumentAsNonInteractive('event');

src/Maker/MakeMessage.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
5050
{
5151
$command
5252
->addArgument('name', InputArgument::OPTIONAL, 'The name of the message class (e.g. <fg=yellow>SendEmailMessage</>)')
53-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeMessage.txt'))
53+
->setHelp($this->getHelpFileContents('MakeMessage.txt'))
5454
;
5555
}
5656

src/Maker/MakeMessengerMiddleware.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
4545
{
4646
$command
4747
->addArgument('name', InputArgument::OPTIONAL, 'The name of the middleware class (e.g. <fg=yellow>CustomMiddleware</>)')
48-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeMessage.txt'));
48+
->setHelp($this->getHelpFileContents('MakeMessage.txt'))
49+
;
4950
}
5051

5152
public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator): void

src/Maker/MakeMigration.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function setApplication(Application $application)
6060
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
6161
{
6262
$command
63-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeMigration.txt'))
63+
->setHelp($this->getHelpFileContents('MakeMigration.txt'))
6464
;
6565

6666
if (class_exists(MigrationsDiffDoctrineCommand::class)) {

src/Maker/MakeRegistrationForm.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static function getCommandDescription(): string
108108
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
109109
{
110110
$command
111-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeRegistrationForm.txt'))
111+
->setHelp($this->getHelpFileContents('MakeRegistrationForm.txt'))
112112
;
113113

114114
$this->configureCommandWithTestsOption($command);

src/Maker/MakeResetPassword.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static function getCommandDescription(): string
119119
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
120120
{
121121
$command
122-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeResetPassword.txt'))
122+
->setHelp($this->getHelpFileContents('MakeResetPassword.txt'))
123123
;
124124

125125
$this->addWithUuidOption($command);

src/Maker/MakeSchedule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function getCommandDescription(): string
5858
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
5959
{
6060
$command
61-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeScheduler.txt'))
61+
->setHelp($this->getHelpFileContents('MakeScheduler.txt'))
6262
;
6363
}
6464

src/Maker/MakeSerializerEncoder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
4444
$command
4545
->addArgument('name', InputArgument::OPTIONAL, 'Choose a class name for your encoder (e.g. <fg=yellow>YamlEncoder</>)')
4646
->addArgument('format', InputArgument::OPTIONAL, 'Pick your format name (e.g. <fg=yellow>yaml</>)')
47-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeSerializerEncoder.txt'))
47+
->setHelp($this->getHelpFileContents('MakeSerializerEncoder.txt'))
4848
;
4949
}
5050

src/Maker/MakeSerializerNormalizer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
5454
{
5555
$command
5656
->addArgument('name', InputArgument::OPTIONAL, 'Choose a class name for your normalizer (e.g. <fg=yellow>UserNormalizer</>)')
57-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeSerializerNormalizer.txt'))
57+
->setHelp($this->getHelpFileContents('MakeSerializerNormalizer.txt'))
5858
;
5959
}
6060

src/Maker/MakeStimulusController.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
4444
{
4545
$command
4646
->addArgument('name', InputArgument::REQUIRED, 'The name of the Stimulus controller (e.g. <fg=yellow>hello</>)')
47-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeStimulusController.txt'));
47+
->setHelp($this->getHelpFileContents('MakeStimulusController.txt'))
48+
;
4849
}
4950

5051
public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void

src/Maker/MakeSubscriber.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
5555
$command
5656
->addArgument('name', InputArgument::OPTIONAL, 'Choose a class name for your event subscriber (e.g. <fg=yellow>ExceptionSubscriber</>)')
5757
->addArgument('event', InputArgument::OPTIONAL, 'What event do you want to subscribe to?')
58-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeSubscriber.txt'))
58+
->setHelp($this->getHelpFileContents('MakeSubscriber.txt'))
5959
;
6060

6161
$inputConfig->setArgumentAsNonInteractive('event');

src/Maker/MakeTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
8282
$command
8383
->addArgument('type', InputArgument::OPTIONAL, 'The type of test: '.implode(', ', $typesDesc))
8484
->addArgument('name', InputArgument::OPTIONAL, 'The name of the test class (e.g. <fg=yellow>BlogPostTest</>)')
85-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeTest.txt').implode("\n", $typesHelp));
85+
->setHelp($this->getHelpFileContents('MakeTest.txt').implode("\n", $typesHelp))
86+
;
8687

8788
$inputConfig->setArgumentAsNonInteractive('name');
8889
$inputConfig->setArgumentAsNonInteractive('type');

src/Maker/MakeTwigExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
4444
{
4545
$command
4646
->addArgument('name', InputArgument::OPTIONAL, 'The name of the Twig extension class (e.g. <fg=yellow>AppExtension</>)')
47-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeTwigExtension.txt'))
47+
->setHelp($this->getHelpFileContents('MakeTwigExtension.txt'))
4848
;
4949
}
5050

src/Maker/MakeUnitTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
4545
{
4646
$command
4747
->addArgument('name', InputArgument::OPTIONAL, 'The name of the unit test class (e.g. <fg=yellow>UtilTest</>)')
48-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeUnitTest.txt'))
48+
->setHelp($this->getHelpFileContents('MakeUnitTest.txt'))
4949
;
5050
}
5151

src/Maker/MakeUser.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
7777
->addOption('is-entity', null, InputOption::VALUE_NONE, 'Do you want to store user data in the database (via Doctrine)?')
7878
->addOption('identity-property-name', null, InputOption::VALUE_REQUIRED, 'Enter a property name that will be the unique "display" name for the user (e.g. <comment>email, username, uuid</comment>)')
7979
->addOption('with-password', null, InputOption::VALUE_NONE, 'Will this app be responsible for checking the password? Choose <comment>No</comment> if the password is actually checked by some other system (e.g. a single sign-on server)')
80-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeUser.txt'));
80+
->setHelp($this->getHelpFileContents('MakeUser.txt'))
81+
;
8182

8283
$this->addWithUuidOption($command);
8384

src/Maker/MakeValidator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
4545
{
4646
$command
4747
->addArgument('name', InputArgument::OPTIONAL, 'The name of the validator class (e.g. <fg=yellow>EnabledValidator</>)')
48-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeValidator.txt'))
48+
->setHelp($this->getHelpFileContents('MakeValidator.txt'))
4949
;
5050
}
5151

src/Maker/MakeVoter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
4343
{
4444
$command
4545
->addArgument('name', InputArgument::OPTIONAL, 'The name of the security voter class (e.g. <fg=yellow>BlogPostVoter</>)')
46-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeVoter.txt'))
46+
->setHelp($this->getHelpFileContents('MakeVoter.txt'))
4747
;
4848
}
4949

src/Maker/MakeWebhook.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
9090
{
9191
$command
9292
->addArgument('name', InputArgument::OPTIONAL, 'Name of the webhook to create (e.g. <fg=yellow>github, stripe, ...</>)')
93-
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeWebhook.txt'))
93+
->setHelp($this->getHelpFileContents('MakeWebhook.txt'))
9494
;
9595

9696
$inputConfig->setArgumentAsNonInteractive('name');

src/Maker/Security/MakeCustomAuthenticator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static function getCommandDescription(): string
6868
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
6969
{
7070
$command
71-
->setHelp(file_get_contents(__DIR__.'/../../Resources/help/security/MakeCustom.txt'))
71+
->setHelp($this->getHelpFileContents('security/MakeCustom.txt'))
7272
;
7373
}
7474

src/Maker/Security/MakeFormLogin.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ public static function getCommandName(): string
7777

7878
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
7979
{
80-
$command->setHelp(file_get_contents(\dirname(__DIR__, 2).'/Resources/help/security/MakeFormLogin.txt'));
80+
$command
81+
->setHelp($this->getHelpFileContents('security/MakeFormLogin.txt'))
82+
;
8183

8284
$this->configureCommandWithTestsOption($command);
8385
}

0 commit comments

Comments
 (0)