<?php

namespace App\Service;

class Message {
    
    public function get()
    {
        if (isset($_SESSION['message'])) {
            $array = explode(',', $_SESSION['message']);
            unset($_SESSION['message']);

            return $array;   
        }

        return '';
    }

    public function set($message, $type = null)
    {
        $_SESSION['message'] = implode(',', [$message, $type]);   
    }
}