ConsoleCommand.php 936 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 Symfony\Component\Console\Command\Command;
  10. use Symfony\Component\Console\Input\InputInterface;
  11. use Symfony\Component\Console\Output\OutputInterface;
  12. /**
  13. * Class ConsoleCommand
  14. * @package Grav\Console
  15. */
  16. class ConsoleCommand extends Command
  17. {
  18. use ConsoleTrait;
  19. /**
  20. * @param InputInterface $input
  21. * @param OutputInterface $output
  22. * @return int
  23. */
  24. protected function execute(InputInterface $input, OutputInterface $output)
  25. {
  26. $this->setupConsole($input, $output);
  27. return $this->serve();
  28. }
  29. /**
  30. * Override with your implementation.
  31. *
  32. * @return int
  33. */
  34. protected function serve()
  35. {
  36. // Return error.
  37. return 1;
  38. }
  39. }