src/Controller/BaseController.php
protected function mergeFlashMessages($messageArray)
    {
        $messages = array_values($messageArray);
        $flashMessage = '';
        $flashMessageArr = [];
        foreach ($messages as $message) {
            if (is_array($message)) {
                if (strlen($flashMessage) > 0) {
                    $flashMessage .= '<br/>';
                }
                $flashMessage .= $this->mergeFlashMessages($message);
            } else {
                $flashMessageArr[] = $message;
            }
        }

        return $flashMessage . implode('<br/>', $flashMessageArr);
    }
protected function mergeFlashMessages($messageArray)
    {
        $messages = array_values($messageArray);
        $flashMessage = '';
        $flashMessageArr = [];
        foreach ($messages as $message) {
            if (is_array($message)) {
                if (strlen($flashMessage) > 0) {
                    $flashMessage .= '<br/>';
                }
                $flashMessage .= $this->mergeFlashMessages($message);
            } else {
                $flashMessageArr[] = $message;
            }
        }

        return $flashMessage . implode('<br/>', $flashMessageArr);
    }
merge flash messages
@author Adeyemi Olaoye <yemi@cottacush.com>
@param $messageArray
@return string