Command.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxVps\Core\CommandLine;
  3. use Symfony\Component\Console\Input\InputInterface;
  4. use Symfony\Component\Console\Output\OutputInterface;
  5. use Symfony\Component\Console\Style\SymfonyStyle;
  6. /**
  7. * Class Command
  8. * @package ModulesGarden\Servers\ProxmoxVps\Core\CommandLine
  9. */
  10. class Command extends AbstractCommand
  11. {
  12. /**
  13. *
  14. */
  15. final protected function configure()
  16. {
  17. parent::configure();
  18. }
  19. /**
  20. * Execute command
  21. * @param InputInterface $input
  22. * @param OutputInterface $output
  23. */
  24. final protected function execute(InputInterface $input, OutputInterface $output)
  25. {
  26. return parent::execute($input, $output, new SymfonyStyle($input, $output));
  27. }
  28. /**
  29. * @param InputInterface $input
  30. * @param OutputInterface $output
  31. * @throws \Exception
  32. */
  33. protected function beforeProcess(InputInterface $input, OutputInterface $output)
  34. {
  35. (new Hypervisor($this->getName(), $input->getOptions()))
  36. ->lock();
  37. }
  38. /**
  39. * @param InputInterface $input
  40. * @param OutputInterface $output
  41. */
  42. protected function afterProcess(InputInterface $input, OutputInterface $output)
  43. {
  44. (new Hypervisor($this->getName(), $input->getOptions()))
  45. ->unlock();
  46. }
  47. }