PHP Classes
elePHPant
Icontem

File: src/function.php

Recommend this page to a friend!
  Classes of Yuriy Tkachenko  >  Simple Flash Messages  >  src/function.php  >  Download  
File: src/function.php
Role: Auxiliary script
Content type: text/plain
Description: function
Class: Simple Flash Messages
Display message with different CSS frameworks
Author: By
Last change:
Date: 1 year ago
Size: 708 bytes
 

Contents

Class file image Download
<?php

use Tamtamchik\SimpleFlash\Flash;
use
Tamtamchik\SimpleFlash\TemplateInterface;

if ( !
function_exists('flash')) {

   
/**
     * Wrapper for flash object to be used as global function.
     *
     * @param string $message - message text
     * @param string $type - message type: success, info, warning, error
     * @param TemplateInterface $template - template (optional)
     *
     * @return Flash
     */
   
function flash($message = '', $type = 'info', TemplateInterface $template = null)
    {
       
$flash = new Flash($template);

        if ( ! empty(
$message)) {
            return
$flash->message($message, $type);
        }

        return
$flash;
    }
}