PHP Classes

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: Format and add new test for Premier
Update for version 2.0
Date: 11 months ago
Size: 835 bytes
 

Contents

Class file image Download
<?php

use Tamtamchik\SimpleFlash\Engine;
use
Tamtamchik\SimpleFlash\Flash;
use
Tamtamchik\SimpleFlash\TemplateInterface;
use
Tamtamchik\SimpleFlash\Exceptions\FlashTemplateNotFoundException;

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 Engine|Flash
     * @throws FlashTemplateNotFoundException
     */
   
function flash($message = '', $type = 'info', TemplateInterface $template = null)
    {
       
$flash = new Flash($template);

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

        return
$flash;
    }
}

For more information send a message to info at phpclasses dot org.