GpmCommand.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * @package Grav\Console
  4. *
  5. * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
  6. * @license MIT License; see LICENSE file for details.
  7. */
  8. namespace Grav\Console;
  9. use Grav\Common\Config\Config;
  10. use Grav\Common\Grav;
  11. use Symfony\Component\Console\Command\Command;
  12. use Symfony\Component\Console\Input\InputInterface;
  13. use Symfony\Component\Console\Output\OutputInterface;
  14. /**
  15. * Class ConsoleCommand
  16. * @package Grav\Console
  17. */
  18. class GpmCommand extends Command
  19. {
  20. use ConsoleTrait;
  21. /**
  22. * @param InputInterface $input
  23. * @param OutputInterface $output
  24. * @return int
  25. */
  26. protected function execute(InputInterface $input, OutputInterface $output)
  27. {
  28. $this->setupConsole($input, $output);
  29. $grav = Grav::instance();
  30. $grav['config']->init();
  31. $grav['uri']->init();
  32. // @phpstan-ignore-next-line
  33. $grav['accounts'];
  34. return $this->serve();
  35. }
  36. /**
  37. * Override with your implementation.
  38. *
  39. * @return int
  40. */
  41. protected function serve()
  42. {
  43. // Return error.
  44. return 1;
  45. }
  46. /**
  47. * @return void
  48. */
  49. protected function displayGPMRelease()
  50. {
  51. /** @var Config $config */
  52. $config = Grav::instance()['config'];
  53. $io = $this->getIO();
  54. $io->newLine();
  55. $io->writeln('GPM Releases Configuration: <yellow>' . ucfirst($config->get('system.gpm.releases')) . '</yellow>');
  56. $io->newLine();
  57. }
  58. }