OpenSource CLI-App to install and handle stuff related to Web-Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
759 B

4 years ago
  1. <?php
  2. namespace App\Menus\Nginx;
  3. use PhpSchool\CliMenu\CliMenu;
  4. use App\Facades\NginxVhost;
  5. use App\Facades\NginxVhostFactory;
  6. /**
  7. * @author Aydin Hassan <aydin@hotmail.co.uk>
  8. */
  9. class NginxVhostGoBackAction
  10. {
  11. // index for vhosts
  12. const VHOST_INDEX = 0;
  13. /**
  14. *
  15. * @param CliMenu $menu [description]
  16. * @return [type] [description]
  17. */
  18. public function __invoke(CliMenu $menu): void
  19. {
  20. $parent = $menu->getParent();
  21. $menu->closeThis();
  22. if ($parent->getParent()) {
  23. $menu = $parent->getParent();
  24. } else {
  25. $menu = $parent;
  26. }
  27. $menu = NginxVhostFactory::addVhosts($menu, NginxVhost::find(), self::VHOST_INDEX);
  28. $menu->open();
  29. }
  30. }