BuildSettingsCommand.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace Fgm\Drupal\Composer;
  3. use Composer\Command\BaseCommand;
  4. use Symfony\Component\Console\Input\InputInterface;
  5. use Symfony\Component\Console\Output\OutputInterface;
  6. class BuildSettingsCommand extends BaseBuilderCommand
  7. {
  8. /**
  9. * @var string
  10. */
  11. protected $eventName;
  12. /**
  13. * {@inheritDoc}
  14. */
  15. public function configure()
  16. {
  17. parent::configure();
  18. $this->eventName = $this->getName();
  19. $this
  20. ->setName('build:settings')
  21. ->setDescription('Builds the *.settings.local.php files.')
  22. ->setDefinition([])
  23. ->setHelp(
  24. <<<EOT
  25. The build:settings command combines shared and per-environment parameters and passes
  26. them to the settings.local.php.twig template to build the settings/(build|run).settings.local.php files.
  27. EOT
  28. );
  29. }
  30. /**
  31. * {@inheritDoc}
  32. */
  33. public function execute(InputInterface $input, OutputInterface $output)
  34. {
  35. $messageFormat = empty($this->eventName)
  36. ? "BuildSettingsCommand Executed on its own"
  37. : "BuildSettingsCommand Executed on \"%s\" event";
  38. $output->write(sprintf($messageFormat, $this->eventName), true);
  39. }
  40. }