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.

38 lines
889 B

4 years ago
  1. <?php
  2. namespace App\Helpers;
  3. /**
  4. *
  5. *
  6. *
  7. */
  8. class TerminalHelper
  9. {
  10. /**
  11. *
  12. * @param [type] $menu [description]
  13. * @param [type] $messages [description]
  14. * @param string $text [description]
  15. * @return [type] [description]
  16. */
  17. public function confirmArray($menu, $messages, $text = 'Ok', $field = NULL)
  18. {
  19. foreach($messages as $key => $message) {
  20. if (is_array($message)) {
  21. $this->confirmArray($menu, $message, $text, $key);
  22. } else {
  23. // reset prefix
  24. $prefix = '';
  25. // if field is not null, add prefix
  26. if ($field) {
  27. $prefix = $field.' ';
  28. }
  29. // adding confirm message
  30. $menu->confirm($prefix.$message)->display($text);
  31. }
  32. }
  33. }
  34. }