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.

42 lines
1.0 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <?php
  2. namespace App\Helpers;
  3. /**
  4. * Helper for Terminal
  5. *
  6. * @author Björn Hase, Tentakelfabrik
  7. * @license http://opensource.org/licenses/MIT The MIT License
  8. * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp
  9. *
  10. */
  11. class TerminalHelper
  12. {
  13. /**
  14. * show array and create for each confirm
  15. *
  16. * @param object $menu
  17. * @param array $messages
  18. * @param string $text
  19. *
  20. */
  21. public function confirmArray($menu, $messages, $text = 'Ok', $field = NULL)
  22. {
  23. foreach($messages as $key => $message) {
  24. if (is_array($message)) {
  25. $this->confirmArray($menu, $message, $text, $key);
  26. } else {
  27. // reset prefix
  28. $prefix = '';
  29. // if field is not null, add prefix
  30. if ($field) {
  31. $prefix = $field.' ';
  32. }
  33. // adding confirm message
  34. $menu->confirm($prefix.$message)->display($text);
  35. }
  36. }
  37. }
  38. }