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.
 
 
 

43 lines
1.0 KiB

<?php
namespace App\Helpers;
/**
* Helper for Terminal
*
* @author Björn Hase, Tentakelfabrik
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp
*
*/
class TerminalHelper
{
/**
* show array and create for each confirm
*
* @param object $menu
* @param array $messages
* @param string $text
*
*/
public function confirmArray($menu, $messages, $text = 'Ok', $field = NULL)
{
foreach($messages as $key => $message) {
if (is_array($message)) {
$this->confirmArray($menu, $message, $text, $key);
} else {
// reset prefix
$prefix = '';
// if field is not null, add prefix
if ($field) {
$prefix = $field.' ';
}
// adding confirm message
$menu->confirm($prefix.$message)->display($text);
}
}
}
}