<?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);
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								    }
							 | 
						|
								}
							 |